Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "ALTAPPS-1356: Shared Python adopted course selection" #1198

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ internal object FeatureKeys {
const val MOBILE_ONLY_SUBSCRIPTION = "mobile.mobile_only_subscription"
const val MOBILE_USERS_INTERVIEW_WIDGET = "mobile.users_interview_widget"
const val MOBILE_CONTENT_TRIAL = "mobile.content_trial"
const val MOBILE_PYTHON_ADOPTED_COURSE = "mobile.python_adopted_course"
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,4 @@ val FeaturesMap.isMobileUsersInterviewWidgetEnabled: Boolean
get() = get(FeatureKeys.MOBILE_USERS_INTERVIEW_WIDGET) ?: false

val FeaturesMap.isMobileContentTrialEnabled: Boolean
get() = get(FeatureKeys.MOBILE_CONTENT_TRIAL) ?: false

val FeaturesMap.isMobilePythonAdoptedCourseEnabled: Boolean
get() = get(FeatureKeys.MOBILE_PYTHON_ADOPTED_COURSE) ?: false
get() = get(FeatureKeys.MOBILE_CONTENT_TRIAL) ?: false
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ internal class WelcomeOnboardingReducer : StateReducer<State, Message, Action> {
WelcomeQuestionnaireType.LEARNING_REASON ->
NavigateTo.WelcomeOnboardingQuestionnaire(WelcomeQuestionnaireType.CODING_EXPERIENCE)
WelcomeQuestionnaireType.CODING_EXPERIENCE ->
// NavigateTo.ChooseProgrammingLanguage
// ALTAPPS-1356: Redirect to Python track directly
NavigateTo.TrackDetails(WelcomeOnboardingTrack.PYTHON)
NavigateTo.ChooseProgrammingLanguage
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ internal class WelcomeOnboardingTrackDetailsComponentImpl(
currentProfileStateRepository = appGraph.profileDataComponent.currentProfileStateRepository,
profileRepository = appGraph.profileDataComponent.profileRepository,
analyticInteractor = appGraph.analyticComponent.analyticInteractor,
featuresDataSource = appGraph.profileDataComponent.featuresDataSource,
logger = appGraph.loggerComponent.logger,
buildVariant = appGraph.commonComponent.buildKonfig.buildVariant,
resourceProvider = appGraph.commonComponent.resourceProvider,
platformType = appGraph.commonComponent.platform.platformType
resourceProvider = appGraph.commonComponent.resourceProvider
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ import co.touchlab.kermit.Logger
import org.hyperskill.app.analytic.domain.interactor.AnalyticInteractor
import org.hyperskill.app.analytic.presentation.wrapWithAnalyticLogger
import org.hyperskill.app.core.domain.BuildVariant
import org.hyperskill.app.core.domain.platform.PlatformType
import org.hyperskill.app.core.presentation.ActionDispatcherOptions
import org.hyperskill.app.core.presentation.transformState
import org.hyperskill.app.core.view.mapper.ResourceProvider
import org.hyperskill.app.features.data.source.FeaturesDataSource
import org.hyperskill.app.logging.presentation.wrapWithLogger
import org.hyperskill.app.profile.domain.model.isMobilePythonAdoptedCourseEnabled
import org.hyperskill.app.profile.domain.repository.CurrentProfileStateRepository
import org.hyperskill.app.profile.domain.repository.ProfileRepository
import org.hyperskill.app.welcome_onboarding.model.WelcomeOnboardingTrack
Expand All @@ -34,15 +31,10 @@ internal object WelcomeOnboardingTrackDetailsFeatureBuilder {
currentProfileStateRepository: CurrentProfileStateRepository,
profileRepository: ProfileRepository,
analyticInteractor: AnalyticInteractor,
featuresDataSource: FeaturesDataSource,
resourceProvider: ResourceProvider,
logger: Logger,
buildVariant: BuildVariant,
platformType: PlatformType
buildVariant: BuildVariant
): Feature<ViewState, Message, Action> {
val isMobilePythonAdoptedCourseEnabled = platformType == PlatformType.IOS &&
featuresDataSource.getFeaturesMap().isMobilePythonAdoptedCourseEnabled

val welcomeOnboardingTrackDetailsReducer =
WelcomeOnboardingTrackDetailsReducer()
.wrapWithLogger(buildVariant, logger, LOG_TAG)
Expand All @@ -57,10 +49,7 @@ internal object WelcomeOnboardingTrackDetailsFeatureBuilder {
val viewStateMapper = WelcomeOnboardingTrackDetailsViewStateMapper(resourceProvider)

return ReduxFeature(
initialState = WelcomeOnboardingTrackDetailsFeature.initialState(
track = track,
isMobilePythonAdoptedCourseEnabled = isMobilePythonAdoptedCourseEnabled
),
initialState = WelcomeOnboardingTrackDetailsFeature.initialState(track),
reducer = welcomeOnboardingTrackDetailsReducer
)
.wrapWithActionDispatcher(welcomeOnboardingTrackDetailsActionDispatcher)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ import org.hyperskill.app.welcome_onboarding.model.WelcomeOnboardingTrack
object WelcomeOnboardingTrackDetailsFeature {
internal data class State(
val track: WelcomeOnboardingTrack,
val isLoadingShowed: Boolean,
val isMobilePythonAdoptedCourseEnabled: Boolean
val isLoadingShowed: Boolean
)

internal fun initialState(
track: WelcomeOnboardingTrack,
isMobilePythonAdoptedCourseEnabled: Boolean
) =
internal fun initialState(track: WelcomeOnboardingTrack) =
State(
track = track,
isLoadingShowed = false,
isMobilePythonAdoptedCourseEnabled = isMobilePythonAdoptedCourseEnabled
isLoadingShowed = false
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal class WelcomeOnboardingTrackDetailsReducer : StateReducer<State, Messag
private const val JS_TRACK_ID = 32L
private const val KOTLIN_TRACK_ID = 69L
private const val PYTHON_TRACK_ID = 6L
private const val PYTHON_TRACK_MOBILE_ADOPTED_ID = 139L
private const val SQL_TRACK_ID = 31L
}

Expand All @@ -42,7 +41,7 @@ internal class WelcomeOnboardingTrackDetailsReducer : StateReducer<State, Messag
InternalAction.LogAnalyticEvent(
WelcomeOnboardingSelectTrackClickedHSAnalyticEvent(state.track)
),
InternalAction.SelectTrack(getTrackId(state))
InternalAction.SelectTrack(getTrackId(state.track))
)

private fun handleSelectTrackSuccess(state: State): WelcomeOnboardingTrackDetailsReducerResult =
Expand All @@ -51,13 +50,12 @@ internal class WelcomeOnboardingTrackDetailsReducer : StateReducer<State, Messag
private fun handleSelectTrackFailed(state: State): WelcomeOnboardingTrackDetailsReducerResult =
state.copy(isLoadingShowed = false) to setOf(Action.ViewAction.ShowTrackSelectionError)

private fun getTrackId(state: State): Long =
when (state.track) {
private fun getTrackId(track: WelcomeOnboardingTrack): Long =
when (track) {
WelcomeOnboardingTrack.JAVA -> JAVA_TRACK_ID
WelcomeOnboardingTrack.JAVA_SCRIPT -> JS_TRACK_ID
WelcomeOnboardingTrack.KOTLIN -> KOTLIN_TRACK_ID
WelcomeOnboardingTrack.PYTHON ->
if (state.isMobilePythonAdoptedCourseEnabled) PYTHON_TRACK_MOBILE_ADOPTED_ID else PYTHON_TRACK_ID
WelcomeOnboardingTrack.PYTHON -> PYTHON_TRACK_ID
WelcomeOnboardingTrack.SQL -> SQL_TRACK_ID
}
}
Loading