Skip to content

Commit 4898027

Browse files
theMr17BenHenning
andauthored
Fix part of #5344: Add new feature flag for multiple classrooms (#5410)
<!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> ## Explanation <!-- - Explain what your PR does. If this PR fixes an existing bug, please include - "Fixes #bugnum:" in the explanation so that GitHub can auto-close the issue - when this PR is merged. --> Fixes part of #5344 This PR introduces a feature flag `ENABLE_MULTIPLE_CLASSROOMS` which will be used to gate the new multiple classrooms screens. ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [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: ...".) - [x] 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 <!-- Delete these section if this PR does not include UI-related changes. --> 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 <[email protected]>
1 parent 64ba622 commit 4898027

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT
1515
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
1616
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
1717
import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE
18+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS
19+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
1820
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY
1921
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE
2022
import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2
@@ -31,6 +33,7 @@ import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLes
3133
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
3234
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
3335
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
36+
import org.oppia.android.util.platformparameter.EnableMultipleClassrooms
3437
import org.oppia.android.util.platformparameter.EnableNpsSurvey
3538
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
3639
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
@@ -335,4 +338,15 @@ class PlatformParameterAlphaKenyaModule {
335338
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
336339
)
337340
}
341+
342+
@Provides
343+
@EnableMultipleClassrooms
344+
fun provideEnableMultipleClassrooms(
345+
platformParameterSingleton: PlatformParameterSingleton
346+
): PlatformParameterValue<Boolean> {
347+
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_MULTIPLE_CLASSROOMS)
348+
?: PlatformParameterValue.createDefaultParameter(
349+
ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
350+
)
351+
}
338352
}

domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT
1515
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
1616
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
1717
import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE
18+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS
19+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
1820
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY
1921
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE
2022
import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2
@@ -30,6 +32,7 @@ import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLes
3032
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
3133
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
3234
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
35+
import org.oppia.android.util.platformparameter.EnableMultipleClassrooms
3336
import org.oppia.android.util.platformparameter.EnableNpsSurvey
3437
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
3538
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
@@ -330,4 +333,15 @@ class PlatformParameterAlphaModule {
330333
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
331334
)
332335
}
336+
337+
@Provides
338+
@EnableMultipleClassrooms
339+
fun provideEnableMultipleClassrooms(
340+
platformParameterSingleton: PlatformParameterSingleton
341+
): PlatformParameterValue<Boolean> {
342+
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_MULTIPLE_CLASSROOMS)
343+
?: PlatformParameterValue.createDefaultParameter(
344+
ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
345+
)
346+
}
333347
}

domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterModule.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT
1515
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
1616
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
1717
import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE
18+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS
19+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
1820
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY
1921
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE
2022
import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2
@@ -31,6 +33,7 @@ import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLes
3133
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
3234
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
3335
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
36+
import org.oppia.android.util.platformparameter.EnableMultipleClassrooms
3437
import org.oppia.android.util.platformparameter.EnableNpsSurvey
3538
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
3639
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
@@ -332,4 +335,15 @@ class PlatformParameterModule {
332335
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
333336
)
334337
}
338+
339+
@Provides
340+
@EnableMultipleClassrooms
341+
fun provideEnableMultipleClassrooms(
342+
platformParameterSingleton: PlatformParameterSingleton
343+
): PlatformParameterValue<Boolean> {
344+
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_MULTIPLE_CLASSROOMS)
345+
?: PlatformParameterValue.createDefaultParameter(
346+
ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
347+
)
348+
}
335349
}

testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT
1414
import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
1515
import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE
1616
import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE
17+
import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
1718
import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE
1819
import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
1920
import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
@@ -25,6 +26,7 @@ import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLes
2526
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
2627
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
2728
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
29+
import org.oppia.android.util.platformparameter.EnableMultipleClassrooms
2830
import org.oppia.android.util.platformparameter.EnableNpsSurvey
2931
import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2
3032
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
@@ -283,6 +285,12 @@ class TestPlatformParameterModule {
283285
return PlatformParameterValue.createDefaultParameter(enableOnboardingFlowV2)
284286
}
285287

288+
@Provides
289+
@EnableMultipleClassrooms
290+
fun provideEnableMultipleClassrooms(): PlatformParameterValue<Boolean> {
291+
return PlatformParameterValue.createDefaultParameter(enableMultipleClassrooms)
292+
}
293+
286294
companion object {
287295
private var enableDownloadsSupport = ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
288296
private var enableEditAccountsOptionsUi = ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
@@ -302,6 +310,7 @@ class TestPlatformParameterModule {
302310
private var gracePeriodInDays = NPS_SURVEY_GRACE_PERIOD_IN_DAYS_DEFAULT_VALUE
303311
private var enableNpsSurvey = ENABLE_NPS_SURVEY_DEFAULT_VALUE
304312
private var enableOnboardingFlowV2 = ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
313+
private var enableMultipleClassrooms = ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
305314

306315
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
307316
fun forceEnableDownloadsSupport(value: Boolean) {
@@ -368,6 +377,12 @@ class TestPlatformParameterModule {
368377
enableOnboardingFlowV2 = value
369378
}
370379

380+
/** Enables forcing [EnableMultipleClassrooms] platform parameter flag from tests. */
381+
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
382+
fun forceEnableMultipleClassrooms(value: Boolean) {
383+
enableMultipleClassrooms = value
384+
}
385+
371386
/** Enables forcing [EnableAppAndOsDeprecation] feature flag from tests. */
372387
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
373388
fun forceEnableAppAndOsDeprecation(value: Boolean) {
@@ -387,6 +402,7 @@ class TestPlatformParameterModule {
387402
enablePerformanceMetricsCollection = ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE
388403
enableAppAndOsDeprecation = ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE
389404
enableOnboardingFlowV2 = ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
405+
enableMultipleClassrooms = ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE
390406
}
391407
}
392408
}

utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,13 @@ const val ENABLE_ONBOARDING_FLOW_V2 = "enable_onboarding_flow_v2"
176176

177177
/** Default value of the feature flag corresponding to [EnableOnboardingFlowV2]. */
178178
const val ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE = false
179+
180+
/** Qualifier for the feature flag that toggles the new multiple classrooms. */
181+
@Qualifier
182+
annotation class EnableMultipleClassrooms
183+
184+
/** Name of the feature flag that toggles the new multiple classrooms. */
185+
const val ENABLE_MULTIPLE_CLASSROOMS = "enable_multiple_classrooms"
186+
187+
/** Default value of the feature flag corresponding to [EnableMultipleClassrooms]. */
188+
const val ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE = false

0 commit comments

Comments
 (0)