Skip to content

Commit

Permalink
Remove the EnableLanguageSelectionUi Feature Flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanikanta335 committed Nov 21, 2023
1 parent 2e2f917 commit 002e5b6
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProvider
import org.oppia.android.util.data.DataProviders.Companion.combineWith
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.PlatformParameterValue
import javax.inject.Inject

/** [ViewModel] for [OptionsFragment]. */
Expand All @@ -32,7 +30,6 @@ class OptionControlsViewModel @Inject constructor(
activity: AppCompatActivity,
private val profileManagementController: ProfileManagementController,
private val oppiaLogger: OppiaLogger,
@EnableLanguageSelectionUi private val enableLanguageSelectionUi: PlatformParameterValue<Boolean>,
private val resourceHandler: AppLanguageResourceHandler,
private val translationController: TranslationController
) : OptionsItemViewModel() {
Expand Down Expand Up @@ -112,13 +109,12 @@ class OptionControlsViewModel @Inject constructor(
}

private fun createAppLanguageViewModel(language: OppiaLanguage): OptionsAppLanguageViewModel? {
return if (enableLanguageSelectionUi.value) {
OptionsAppLanguageViewModel(
return OptionsAppLanguageViewModel(
routeToAppLanguageListListener,
loadAppLanguageListListener, language,
resourceHandler.computeLocalizedDisplayName(language)
)
} else null

}

private fun createAudioLanguageViewModel(profile: Profile): OptionsAudioLanguageViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ class OptionsFragmentTest {

@Before
fun setUp() {
TestPlatformParameterModule.forceEnableLanguageSelectionUi(true)
Intents.init()
setUpTestApplicationComponent()
testCoroutineDispatchers.registerIdlingResource()
Expand Down Expand Up @@ -370,7 +369,6 @@ class OptionsFragmentTest {

@Test
fun testOptionsFragment_featureDisabled_appLanguageOptionIsNotDisplayed() {
TestPlatformParameterModule.forceEnableLanguageSelectionUi(false)

launch<OptionsActivity>(
createOptionActivityIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class OptionsFragmentTest {

@Before
fun setUp() {
TestPlatformParameterModule.forceEnableLanguageSelectionUi(true)
TestPlatformParameterModule.forceEnableEditAccountsOptionsUi(
ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
)
Expand Down Expand Up @@ -171,7 +170,6 @@ class OptionsFragmentTest {

@Test
fun testOptionsFragment_featureDisabled_appLanguageItemIsNotDisplayed() {
TestPlatformParameterModule.forceEnableLanguageSelectionUi(false)
launch<OptionsActivity>(createOptionActivityIntent(0, true)).use {
testCoroutineDispatchers.runCurrent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
Expand Down Expand Up @@ -94,14 +93,6 @@ class PlatformParameterAlphaKenyaModule {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableEditAccountsOptionsUi
fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
Expand Down Expand Up @@ -91,14 +90,6 @@ class PlatformParameterAlphaModule {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableEditAccountsOptionsUi
fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
Expand Down Expand Up @@ -93,14 +92,6 @@ class PlatformParameterModule {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableEditAccountsOptionsUi
fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import org.oppia.android.util.logging.LogLevel
import org.oppia.android.util.logging.SyncStatusModule
import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE
Expand Down Expand Up @@ -370,14 +369,6 @@ class LoggingIdentifierControllerTest {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableLearnerStudyAnalytics
fun provideLearnerStudyAnalytics(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import org.oppia.android.util.logging.LogLevel
import org.oppia.android.util.logging.SyncStatusModule
import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE
Expand Down Expand Up @@ -391,14 +390,6 @@ class OppiaLoggerTest {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableLearnerStudyAnalytics
fun provideLearnerStudyAnalytics(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi
import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection
Expand Down Expand Up @@ -118,11 +117,6 @@ class TestPlatformParameterModule {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> =
PlatformParameterValue.createDefaultParameter(enableLanguageSelectionUi)

@Provides
@EnableEditAccountsOptionsUi
fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue<Boolean> =
Expand Down Expand Up @@ -272,7 +266,6 @@ class TestPlatformParameterModule {

companion object {
private var enableDownloadsSupport = ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
private var enableLanguageSelectionUi = ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
private var enableEditAccountsOptionsUi = ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
private var enableLearnerStudyAnalytics = LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE
private var enableFastLanguageSwitchingInLesson =
Expand All @@ -289,18 +282,11 @@ 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

/** Enables forcing [EnableLanguageSelectionUi] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun forceEnableDownloadsSupport(value: Boolean) {
enableDownloadsSupport = value
}

/** Enables forcing [EnableLanguageSelectionUi] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun forceEnableLanguageSelectionUi(value: Boolean) {
enableLanguageSelectionUi = value
}

/** Enables forcing [EnableEditAccountsOptionsUI] platform parameter flag from tests. */
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun forceEnableEditAccountsOptionsUi(value: Boolean) {
Expand Down Expand Up @@ -352,7 +338,6 @@ class TestPlatformParameterModule {
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
fun reset() {
enableDownloadsSupport = ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE
enableLanguageSelectionUi = ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
enableEditAccountsOptionsUi = ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE
enableLearnerStudyAnalytics = LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE
enableFastLanguageSwitchingInLesson = FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ const val SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS = "sync_up_worker_time_period"
*/
const val SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE = 12

/** Qualifier for the feature flag corresponding to enabling the language selection UI. */
@Qualifier
annotation class EnableLanguageSelectionUi

/** Default value for the feature flag corresponding to [EnableLanguageSelectionUi]. */
const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = true

/**
* Qualifier for the feature flag corresponding to enabling the extra topic tabs: practice and info.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.oppia.android.util.data.DataProvidersInjectorProvider
import org.oppia.android.util.locale.LocaleProdModule
import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE
Expand Down Expand Up @@ -109,14 +108,6 @@ class SyncStatusManagerImplTest : SyncStatusManagerTestBase() {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableLearnerStudyAnalytics
fun provideLearnerStudyAnalytics(): PlatformParameterValue<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.oppia.android.util.logging.SyncStatusModule
import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger
import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE
Expand Down Expand Up @@ -99,14 +98,6 @@ class LogReportingModuleTest {
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}

@Provides
@EnableLoggingLearnerStudyIds
fun provideLoggingLearnerStudyIds(): PlatformParameterValue<Boolean> {
Expand Down

0 comments on commit 002e5b6

Please sign in to comment.