Skip to content

Commit

Permalink
fixes/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkash committed Oct 2, 2023
1 parent c0fe003 commit 06e10eb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ object FirstProblemOnboardingFeature {
internal data class State(
val profileState: ProfileState,
val nextLearningActivityState: NextLearningActivityState,
/**
* Field to differ new and existing users to change screen texts/icons
*/
val isNewUserMode: Boolean,
/**
* Flag for displaying loading animation (after click on CTA button)
*/
val isLearningActivityLoading: Boolean = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ internal class FirstProblemOnboardingReducer : StateReducer<State, Message, Acti
if (state.profileState is ProfileState.Idle &&
state.nextLearningActivityState is NextLearningActivityState.Idle
) {
state.updateProfileState(ProfileState.Loading) to setOf(
InternalAction.FetchProfile,
InternalAction.FetchNextLearningActivity
)
state
.updateProfileState(ProfileState.Loading)
.updateNextLearningActivityState(NextLearningActivityState.Loading) to
setOf(
InternalAction.FetchProfile,
InternalAction.FetchNextLearningActivity
)
} else {
null
}
Expand Down Expand Up @@ -71,11 +74,12 @@ internal class FirstProblemOnboardingReducer : StateReducer<State, Message, Acti
FirstProblemOnboardingFeature.FetchNextLearningActivityResult.Error ->
state
.copy(isLearningActivityLoading = false)
.updateNextLearningActivityState(NextLearningActivityState.Error) to buildSet {
if (state.isLearningActivityLoading) {
add(Action.ViewAction.ShowNetworkError)
.updateNextLearningActivityState(NextLearningActivityState.Error) to
buildSet {
if (state.isLearningActivityLoading) {
add(Action.ViewAction.ShowNetworkError)
}
}
}
is FirstProblemOnboardingFeature.FetchNextLearningActivityResult.Success ->
if (state.isLearningActivityLoading) {
state.copy(isLearningActivityLoading = false) to setOf(
Expand Down

0 comments on commit 06e10eb

Please sign in to comment.