From 604b609e1fd7dc18519da60c8434bb6e9fec60a5 Mon Sep 17 00:00:00 2001 From: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> Date: Wed, 7 Feb 2024 09:14:51 +0300 Subject: [PATCH] Fix Part of #4938: New onboarding flow gating platform param 1 of 3 (#5269) ## Explanation Fix Part of #4938: Introduce a new platform parameter that will be used to gate the revised onboarding flow during development. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [ ] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing --------- Co-authored-by: Ben Henning --- .../PlatformParameterAlphaKenyaModule.kt | 14 ++++++++++++++ .../PlatformParameterAlphaModule.kt | 14 ++++++++++++++ .../platformparameter/PlatformParameterModule.kt | 14 ++++++++++++++ .../TestPlatformParameterModule.kt | 16 ++++++++++++++++ .../platformparameter/FeatureFlagConstants.kt | 10 ++++++++++ 5 files changed, 68 insertions(+) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt index 6a9820e4c47..9213fcc5a7f 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt @@ -17,6 +17,8 @@ import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAU import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2 +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE @@ -30,6 +32,7 @@ import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeSta import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds import org.oppia.android.util.platformparameter.EnableNpsSurvey +import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON @@ -321,4 +324,15 @@ class PlatformParameterAlphaKenyaModule { ENABLE_NPS_SURVEY_DEFAULT_VALUE ) } + + @Provides + @EnableOnboardingFlowV2 + fun provideEnableOnboardingFlowV2( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2) + ?: PlatformParameterValue.createDefaultParameter( + ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE + ) + } } diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt index 83c1909dde0..e453cf5d94e 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt @@ -17,6 +17,8 @@ import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAU import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2 +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.EXTRA_TOPIC_TABS_UI @@ -29,6 +31,7 @@ import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeSta import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds import org.oppia.android.util.platformparameter.EnableNpsSurvey +import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON @@ -316,4 +319,15 @@ class PlatformParameterAlphaModule { ENABLE_NPS_SURVEY_DEFAULT_VALUE ) } + + @Provides + @EnableOnboardingFlowV2 + fun provideEnableOnboardingFlowV2( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2) + ?: PlatformParameterValue.createDefaultParameter( + ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE + ) + } } diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt index 17e63902dde..6bf45843564 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt @@ -17,6 +17,8 @@ import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAU import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2 +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE @@ -30,6 +32,7 @@ import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeSta import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds import org.oppia.android.util.platformparameter.EnableNpsSurvey +import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON @@ -318,4 +321,15 @@ class PlatformParameterModule { ENABLE_NPS_SURVEY_DEFAULT_VALUE ) } + + @Provides + @EnableOnboardingFlowV2 + fun provideEnableOnboardingFlowV2( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2) + ?: PlatformParameterValue.createDefaultParameter( + ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE + ) + } } diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt index 1d0f9f02bfc..604eaf727e4 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt @@ -14,6 +14,7 @@ import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_ import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation import org.oppia.android.util.platformparameter.EnableDownloadsSupport @@ -24,6 +25,7 @@ import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeSta import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds import org.oppia.android.util.platformparameter.EnableNpsSurvey +import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE @@ -271,6 +273,12 @@ class TestPlatformParameterModule { return PlatformParameterValue.createDefaultParameter(enableNpsSurvey) } + @Provides + @EnableOnboardingFlowV2 + fun provideEnableOnboardingFlowV2(): PlatformParameterValue { + return PlatformParameterValue.createDefaultParameter(enableOnboardingFlowV2) + } + companion object { private var enableDownloadsSupport = ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE private var enableEditAccountsOptionsUi = ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE @@ -289,6 +297,7 @@ class TestPlatformParameterModule { NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES_DEFAULT_VALUE private var gracePeriodInDays = NPS_SURVEY_GRACE_PERIOD_IN_DAYS_DEFAULT_VALUE private var enableNpsSurvey = ENABLE_NPS_SURVEY_DEFAULT_VALUE + private var enableOnboardingFlowV2 = ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE @VisibleForTesting(otherwise = VisibleForTesting.NONE) fun forceEnableDownloadsSupport(value: Boolean) { @@ -349,6 +358,12 @@ class TestPlatformParameterModule { enableNpsSurvey = value } + /** Enables forcing [EnableOnboardingFlowV2] platform parameter flag from tests. */ + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + fun forceEnableOnboardingFlowV2(value: Boolean) { + enableOnboardingFlowV2 = value + } + @VisibleForTesting(otherwise = VisibleForTesting.NONE) fun reset() { enableDownloadsSupport = ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE @@ -361,6 +376,7 @@ class TestPlatformParameterModule { ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE enablePerformanceMetricsCollection = ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE enableAppAndOsDeprecation = ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE + enableOnboardingFlowV2 = ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE } } } diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt index e69e34696dd..ba9dafdb620 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt @@ -166,3 +166,13 @@ const val ENABLE_NPS_SURVEY = "enable_nps_survey" /** Default value of the feature flag corresponding to [EnableNpsSurvey]. */ const val ENABLE_NPS_SURVEY_DEFAULT_VALUE = false + +/** Qualifier for the feature flag that toggles the new onboarding flow. */ +@Qualifier +annotation class EnableOnboardingFlowV2 + +/** Name of the feature flag that toggles the new onboarding flow. */ +const val ENABLE_ONBOARDING_FLOW_V2 = "enable_onboarding_flow_v2" + +/** Default value of the feature flag corresponding to [EnableOnboardingFlowV2]. */ +const val ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE = false