Skip to content

Commit

Permalink
Move feature flags to FeatureFlagConstants.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
adhiamboperes committed Jan 31, 2024
1 parent 7962902 commit 0696b6a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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
Expand Down Expand Up @@ -326,9 +327,12 @@ class PlatformParameterAlphaKenyaModule {

@Provides
@EnableOnboardingFlowV2
fun provideEnableNewOnboardingUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
fun provideEnableOnboardingFlowV2(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2)
?: PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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
Expand Down Expand Up @@ -321,9 +322,12 @@ class PlatformParameterAlphaModule {

@Provides
@EnableOnboardingFlowV2
fun provideEnableNewOnboardingUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
fun provideEnableOnboardingFlowV2(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2)
?: PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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
Expand Down Expand Up @@ -323,9 +324,12 @@ class PlatformParameterModule {

@Provides
@EnableOnboardingFlowV2
fun provideEnableNewOnboardingUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
fun provideEnableOnboardingFlowV2(
platformParameterSingleton: PlatformParameterSingleton
): PlatformParameterValue<Boolean> {
return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2)
?: PlatformParameterValue.createDefaultParameter(
ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class TestPlatformParameterModule {

@Provides
@EnableOnboardingFlowV2
fun provideEnableNewOnboardingUi(): PlatformParameterValue<Boolean> {
fun provideEnableOnboardingFlowV2(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(enableOnboardingFlowV2)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,3 @@ const val NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES =
* experience with the app.
*/
const val NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES_DEFAULT_VALUE = 5

/** Qualifier for the platform parameter that toggles the new onboarding flow. */
@Qualifier
annotation class EnableOnboardingFlowV2

/** Name of the platform parameter that toggles the new onboarding flow. */
const val ENABLE_ONBOARDING_FLOW_V2 = "enable_onboarding_flow_v2"

/** Default value of the platform parameter corresponding to [EnableOnboardingFlowV2]. */
const val ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE = false

0 comments on commit 0696b6a

Please sign in to comment.