Skip to content

Commit

Permalink
Gate options behind compile-time flag.
Browse files Browse the repository at this point in the history
Flag status is off by default until #52 is finished.
  • Loading branch information
BenHenning committed Sep 15, 2021
1 parent b266b0c commit b168091
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import org.oppia.android.domain.profile.ProfileManagementController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import javax.inject.Inject
import org.oppia.android.util.platformparameter.EnableLanguageSelectionUi
import org.oppia.android.util.platformparameter.PlatformParameterValue

/** [ViewModel] for [OptionsFragment]. */
@FragmentScope
class OptionControlsViewModel @Inject constructor(
activity: AppCompatActivity,
private val profileManagementController: ProfileManagementController,
private val oppiaLogger: OppiaLogger
private val oppiaLogger: OppiaLogger,
@EnableLanguageSelectionUi private val enableLanguageSelectionUi: PlatformParameterValue<Boolean>
) : OptionsItemViewModel() {
private val itemViewModelList: ObservableList<OptionsItemViewModel> = ObservableArrayList()
private lateinit var profileId: ProfileId
Expand Down Expand Up @@ -96,7 +99,9 @@ class OptionControlsViewModel @Inject constructor(

itemViewModelList.add(optionsReadingTextSizeViewModel as OptionsItemViewModel)

itemViewModelList.add(optionsAppLanguageViewModel as OptionsItemViewModel)
if (enableLanguageSelectionUi.value) {
itemViewModelList.add(optionsAppLanguageViewModel as OptionsItemViewModel)
}

itemViewModelList.add(optionAudioViewViewModel as OptionsItemViewModel)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ class StateFragmentTest {
}

private fun waitForImageViewInteractionToFullyLoad() {
// TODO(#669): Remove explicit delay - https://github.com/oppia/oppia-android/issues/1523
// TODO(#1523): Remove explicit delay - https://github.com/oppia/oppia-android/issues/1523
waitForTheView(
allOf(
withId(R.id.image_click_interaction_image_view),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.oppia.android.domain.platformparameter

import dagger.Module
import dagger.Provides
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.PlatformParameterSingleton
import org.oppia.android.util.platformparameter.PlatformParameterValue
import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG
Expand Down Expand Up @@ -40,4 +42,12 @@ class PlatformParameterModule {
SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE
)
}

@Provides
@EnableLanguageSelectionUi
fun provideEnableLanguageSelectionUi(): PlatformParameterValue<Boolean> {
return PlatformParameterValue.createDefaultParameter(
ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE
)
}
}
6 changes: 2 additions & 4 deletions model/src/main/proto/profile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ enum ReadingTextSize {
EXTRA_LARGE_TEXT_SIZE = 4;
}

// TODO(#669): Add translation for language selection and track updating of this list to match the supported translation list.
// Supported App language for user preference.
// TODO(#3793): Replace this with OppiaLanguage.
enum AppLanguage {
APP_LANGUAGE_UNSPECIFIED = 0;
ENGLISH_APP_LANGUAGE = 1;
Expand All @@ -116,8 +115,7 @@ enum AppLanguage {
CHINESE_APP_LANGUAGE = 4;
}

// TODO(#669): Add translation for language selection and track updating of this list to match the supported translation list.
// Supported Audio language for user preference.
// TODO(#3793): Replace this with OppiaLanguage.
enum AudioLanguage {
AUDIO_LANGUAGE_UNSPECIFIED = 0;
NO_AUDIO = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,11 @@ const val SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS = "sync_up_worker_time_period"
* [PlatformParameterSyncUpWorker] will run again.
*/
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

// TODO(#52): Enable this feature by default once it's completed.
/** Default value for the feature flag corresponding to [EnableLanguageSelectionUi]. */
const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = false

0 comments on commit b168091

Please sign in to comment.