-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Shared, iOS: Code blanks mechanics onboarding (#1183)
^ALTAPPS-1357
1 parent
c49c6f6
commit 1123c3a
Showing
23 changed files
with
240 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../hyperskill/app/step_quiz_code_blanks/presentation/StepQuizCodeBlanksOnboardingReducer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.hyperskill.app.step_quiz_code_blanks.presentation | ||
|
||
import org.hyperskill.app.step_quiz_code_blanks.domain.model.CodeBlock | ||
import org.hyperskill.app.step_quiz_code_blanks.presentation.StepQuizCodeBlanksFeature.Action | ||
import org.hyperskill.app.step_quiz_code_blanks.presentation.StepQuizCodeBlanksFeature.InternalAction | ||
import org.hyperskill.app.step_quiz_code_blanks.presentation.StepQuizCodeBlanksFeature.InternalMessage | ||
import org.hyperskill.app.step_quiz_code_blanks.presentation.StepQuizCodeBlanksFeature.OnboardingState | ||
import org.hyperskill.app.step_quiz_code_blanks.presentation.StepQuizCodeBlanksFeature.State | ||
|
||
class StepQuizCodeBlanksOnboardingReducer { | ||
companion object { | ||
private const val DELETE_BUTTON_STEP_ID = 50969L | ||
private const val SPACE_BUTTON_STEP_ID = 50970L | ||
private val PRINT_SUGGESTION_AND_CALL_TO_ACTION_STEP_IDS = setOf(47329L, 50968L) | ||
} | ||
|
||
internal fun reduceInitializeMessage( | ||
message: InternalMessage.Initialize | ||
): OnboardingState = | ||
when (message.step.id) { | ||
in PRINT_SUGGESTION_AND_CALL_TO_ACTION_STEP_IDS -> | ||
OnboardingState.PrintSuggestionAndCallToAction.HighlightSuggestions | ||
DELETE_BUTTON_STEP_ID -> OnboardingState.HighlightDeleteButton | ||
SPACE_BUTTON_STEP_ID -> OnboardingState.HighlightSpaceButton | ||
else -> OnboardingState.Unavailable | ||
} | ||
|
||
internal fun reduceSuggestionClickedMessage( | ||
state: State.Content, | ||
activeCodeBlock: CodeBlock?, | ||
newCodeBlock: CodeBlock | ||
): Pair<OnboardingState, Set<Action>> { | ||
val isFulfilledOnboardingPrintCodeBlock = | ||
state.onboardingState is OnboardingState.PrintSuggestionAndCallToAction.HighlightSuggestions && | ||
activeCodeBlock is CodeBlock.Print && activeCodeBlock.hasAnyUnselectedChild() && | ||
newCodeBlock is CodeBlock.Print && newCodeBlock.areAllChildrenSelected() | ||
return if (isFulfilledOnboardingPrintCodeBlock) { | ||
OnboardingState.PrintSuggestionAndCallToAction.HighlightCallToActionButton to | ||
setOf( | ||
InternalAction.ParentFeatureActionRequested( | ||
StepQuizCodeBlanksFeature.ParentFeatureAction.HighlightCallToActionButton | ||
) | ||
) | ||
} else { | ||
state.onboardingState to emptySet() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.