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

ALTAPPS-1266: Shared remove short theory experiment #1064

Merged
merged 3 commits into from
May 28, 2024
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 @@ -10,7 +10,6 @@ internal object FeatureKeys {
const val MOBILE_LEADERBOARDS = "mobile_leaderboards"
const val MOBILE_ONLY_SUBSCRIPTION = "mobile.mobile_only_subscription"
const val MOBILE_USERS_INTERVIEW_WIDGET = "mobile.users_interview_widget"
const val MOBILE_SHORT_THEORY = "mobile.short_theory"
const val MOBILE_GPT_CODE_GENERATION_WITH_ERRORS_FORCED_ONBOARDING =
"mobile.gpt_code_generation_with_errors_forced_onboarding_v2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ val FeaturesMap.isMobileOnlySubscriptionEnabled: Boolean
val FeaturesMap.isMobileUsersInterviewWidgetEnabled: Boolean
get() = get(FeatureKeys.MOBILE_USERS_INTERVIEW_WIDGET) ?: false

val FeaturesMap.isMobileShortTheoryEnabled: Boolean
get() = get(FeatureKeys.MOBILE_SHORT_THEORY) ?: false

val FeaturesMap.isMobileGptCodeGenerationWithErrorsEnabled: Boolean
get() = get(FeatureKeys.MOBILE_GPT_CODE_GENERATION_WITH_ERRORS_FORCED_ONBOARDING) ?: false
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ internal class StepComponentImpl(
stepInteractor = appGraph.buildStepDataComponent().stepInteractor,
stepCompletedFlow = appGraph.stepCompletionFlowDataComponent.stepCompletedFlow,
nextLearningActivityStateRepository = appGraph.stateRepositoriesComponent.nextLearningActivityStateRepository,
currentProfileStateRepository = appGraph.profileDataComponent.currentProfileStateRepository,
analyticInteractor = appGraph.analyticComponent.analyticInteractor,
sentryInteractor = appGraph.sentryComponent.sentryInteractor,
stepCompletionReducer = stepCompletionComponent.stepCompletionReducer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.hyperskill.app.core.presentation.ActionDispatcherOptions
import org.hyperskill.app.core.presentation.transformState
import org.hyperskill.app.learning_activities.domain.repository.NextLearningActivityStateRepository
import org.hyperskill.app.logging.presentation.wrapWithLogger
import org.hyperskill.app.profile.domain.repository.CurrentProfileStateRepository
import org.hyperskill.app.sentry.domain.interactor.SentryInteractor
import org.hyperskill.app.step.domain.interactor.StepInteractor
import org.hyperskill.app.step.domain.model.StepRoute
Expand Down Expand Up @@ -37,7 +36,6 @@ internal object StepFeatureBuilder {
stepRoute: StepRoute,
stepInteractor: StepInteractor,
nextLearningActivityStateRepository: NextLearningActivityStateRepository,
currentProfileStateRepository: CurrentProfileStateRepository,
analyticInteractor: AnalyticInteractor,
stepCompletedFlow: StepCompletedFlow,
sentryInteractor: SentryInteractor,
Expand All @@ -59,7 +57,6 @@ internal object StepFeatureBuilder {
stepCompletedFlow = stepCompletedFlow,
stepInteractor = stepInteractor,
nextLearningActivityStateRepository = nextLearningActivityStateRepository,
currentProfileStateRepository = currentProfileStateRepository,
analyticInteractor = analyticInteractor,
sentryInteractor = sentryInteractor,
logger.withTag(LOG_TAG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ import org.hyperskill.app.analytic.domain.interactor.AnalyticInteractor
import org.hyperskill.app.core.domain.DataSourceType
import org.hyperskill.app.core.presentation.ActionDispatcherOptions
import org.hyperskill.app.learning_activities.domain.repository.NextLearningActivityStateRepository
import org.hyperskill.app.profile.domain.model.isMobileShortTheoryEnabled
import org.hyperskill.app.profile.domain.repository.CurrentProfileStateRepository
import org.hyperskill.app.sentry.domain.interactor.SentryInteractor
import org.hyperskill.app.sentry.domain.model.transaction.HyperskillSentryTransactionBuilder
import org.hyperskill.app.sentry.domain.withTransaction
import org.hyperskill.app.step.domain.interactor.StepInteractor
import org.hyperskill.app.step.domain.model.Step
import org.hyperskill.app.step.presentation.StepFeature.Action
import org.hyperskill.app.step.presentation.StepFeature.InternalAction
import org.hyperskill.app.step.presentation.StepFeature.InternalMessage
Expand All @@ -40,7 +37,6 @@ internal class StepActionDispatcher(
stepCompletedFlow: StepCompletedFlow,
private val stepInteractor: StepInteractor,
private val nextLearningActivityStateRepository: NextLearningActivityStateRepository,
private val currentProfileStateRepository: CurrentProfileStateRepository,
private val analyticInteractor: AnalyticInteractor,
private val sentryInteractor: SentryInteractor,
private val logger: Logger
Expand Down Expand Up @@ -95,46 +91,10 @@ internal class StepActionDispatcher(
val step = stepInteractor
.getStep(action.stepRoute.stepId)
.getOrThrow()
.let { applyMobileShortTheoryFeature(it) }
Message.StepLoaded.Success(step)
}.let(onNewMessage)
}

private suspend fun applyMobileShortTheoryFeature(step: Step): Step {
val isMobileShortTheoryEnabled = currentProfileStateRepository
.getState(forceUpdate = false)
.getOrNull()
?.features
?.isMobileShortTheoryEnabled
?: false

return if (isMobileShortTheoryEnabled && step.id == 38627L) {
step.copy(
block = step.block.copy(
text = """
<p>Ever wondered why Java's logo is a steaming cup of coffee? Just as coffee fuels our day, Java powers the tech world with its robust and versatile features! So, grab your cup of coffee and join us on this exciting journey into the world of Java!</p>
<h5 id="what-is-java">What is Java</h5>
<p><span style="font-size: inherit; font-weight: inherit;">Java language was designed by </span>James Gosling in 1995<span style="font-size: inherit; font-weight: inherit;"> to be simple </span><span style="font-size: inherit; font-weight: inherit;">and powerful</span><span style="font-size: inherit; font-weight: inherit;">. </span>It borrows syntax from C and C++, and complements it with <strong>automatic memory management</strong>, and other powerful features. Java's core principle is<strong> </strong>"<strong>Write Once, Run Anywhere</strong>" (WORA), which means that any Java program is platform-independent and can run on any operating system without modifications. </p>
<h5 id="where-is-java-applied">Where is Java Applied</h5>
<p>Waking up you immediately interact with an application built with Java — your phone alarm. When you work or develop your pet projects, Java forms the backbone of development tools like <u>IntelliJ IDEA</u>. Even when relaxing with <u>Netflix</u>, <u>Spotify,</u> or <u>Minecraft</u>, you rely on Java power. Java is like a silent friend, aiding us and making our lives easier in numerous ways, from the moment we wake up till we call it a day. What amazing and helpful Java application are you going to create?</p>
<h5 id="a-sample-of-java">A sample of Java</h5>
<p>Let's start with the classic "Hello, World!" program, a friendly greeting from your computer:</p>
<pre><code class="language-java">public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}</code></pre>
<p>This program simply prints the phrase "Hello, World!" to the console. Don't worry if it looks a bit cryptic now. We'll dive deeper into its logic during the practice part of this topic.</p>
<h5 id="conclusion">Conclusion</h5>
<p>Java is a high-level object-oriented programming language. Its clear syntax, platform independence, and automatic memory management contribute to its popularity. Become a part of the vast Java community by practicing the language basics now. D<span style="font-size: inherit; font-weight: inherit;">on't hesitate to experiment, ask for help if you're stuck, and </span>embrace mistakes as they fuel your learning!<span style="font-size: inherit; font-weight: inherit;"> </span></p>
""".trimIndent()
)
)
} else {
step
}
}

private suspend fun handleUpdateNextLearningActivityStateAction(
action: InternalAction.UpdateNextLearningActivityState
) {
Expand Down
Loading