From 3fee528e6f557ed1c7d82a349782aca82aece5de Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 18 Oct 2023 10:01:59 +0300 Subject: [PATCH 01/20] feat: Add a FeatureFlagConstants file to host feature flags --- .../platformparameter/FeatureFlagConstants.kt | 303 ++++++++++++++++++ .../PlatformParameterConstants.kt | 134 -------- 2 files changed, 303 insertions(+), 134 deletions(-) create mode 100644 utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt 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 new file mode 100644 index 00000000000..a4de5f115d2 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt @@ -0,0 +1,303 @@ +package org.oppia.android.util.platformparameter + +import javax.inject.Qualifier + +/** + * This file contains all the constants that are associated with individual Feature Flags. + * These constants are: + * - Qualifier Annotation + * - Feature Flag Name - The name begins with Enable_ + * - Feature Flag Default Value + * - Feature Flag Status - A boolean that keeps track of whether the feature flag + * has been synced with Oppia Web or not. + */ + +/** + * Qualifier for the feature flag that controls whether the user has support for manually + * downloading topics. + */ +@Qualifier annotation class EnableDownloadsSupport + +/** Default value for feature flag corresponding to [EnableDownloadsSupport]. */ +const val ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableDownloadsSupport] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableDownloadsSupportIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableDownloadsSupportIsServerProvided]. + */ +const val FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** 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 to keep track of the sync status of the [EnableLanguageSelectionUi] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableLanguageSelectionUiIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableLanguageSelectionUiIsServerProvided]. + */ +const val FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for the feature flag corresponding to enabling the extra topic tabs: practice and info. + */ +@Qualifier +annotation class EnableExtraTopicTabsUi + +/** Default value for the feature flag corresponding to [EnableExtraTopicTabsUi]. */ +const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableExtraTopicTabsUi] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableExtraTopicTabsUiIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableExtraTopicTabsUiIsServerProvided]. + */ +const val FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for the feature flag that controls the visibility of [ProfileAndDeviceIdActivity] + * and working of learner study related analytics logging. + */ +@Qualifier +annotation class EnableLearnerStudyAnalytics + +/** + * Name of the feature flag that controls the visibility of [ProfileAndDeviceIdActivity] + * and working of learner study related analytics logging. + */ +const val LEARNER_STUDY_ANALYTICS = "learner_study_analytics" + +/** + * Default value of the feature flag that controls the visibility of [ProfileAndDeviceIdActivity] + * and working of learner study related analytics logging. + */ +const val LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableLearnerStudyAnalytics] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableLearnerStudyAnalyticsIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableLearnerStudyAnalyticsIsServerProvided]. + */ +const val FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for a feature flag that controls whether learners may be allowed (via an + * admin-controlled setting) to use a special in-lesson button for quickly switching between content + * languages. + * + * This is generally expected to only be used in tandem with [EnableLearnerStudyAnalytics]. + */ +@Qualifier annotation class EnableFastLanguageSwitchingInLesson + +/** The feature flag name corresponding to [EnableFastLanguageSwitchingInLesson]. */ +const val FAST_LANGUAGE_SWITCHING_IN_LESSON = "fast_language_switching_in_lesson" + +/** + * The default enabled state for the feature corresponding to [EnableFastLanguageSwitchingInLesson]. + */ +const val FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableFastLanguageSwitchingInLesson] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableFastLanguageSwitchingInLessonIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. + */ +const val FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for a feature flag that controls whether learner study IDs should be generated and + * logged with outgoing events. + * + * This is generally expected to only be used in tandem with [EnableLearnerStudyAnalytics]. + */ +@Qualifier annotation class EnableLoggingLearnerStudyIds + +/** The feature flag name corresponding to [EnableLoggingLearnerStudyIds]. */ +const val LOGGING_LEARNER_STUDY_IDS = "logging_learner_study_ids" + +/** The default enabled state for the feature corresponding to [EnableLoggingLearnerStudyIds]. */ +const val LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableLoggingLearnerStudyIds] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableLoggingLearnerStudyIdsIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableLoggingLearnerStudyIdsIsServerProvided]. + */ +const val FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** Qualifier for the feature flag corresponding to enabling the edit accounts options. */ +@Qualifier +annotation class EnableEditAccountsOptionsUi + +/** Default value for the feature flag corresponding to [EnableEditAccountsOptionsUi]. */ +const val ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableEditAccountsOptionsUi] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableEditAccountsOptionsUiIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableEditAccountsOptionsUiIsServerProvided]. + */ +const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** Qualifier for the platform parameter that controls whether to record performance metrics. */ +@Qualifier +annotation class EnablePerformanceMetricsCollection + +/** Name of the platform parameter that controls whether to record performance metrics. */ +const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_collection" + +/** Default value for whether to record performance metrics. */ +const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnablePerformanceMetricsCollection] and help + * determine if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnablePerformanceMetricsCollectionIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnablePerformanceMetricsCollectionIsServerProvided]. + */ +const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for the platform parameter that controls whether to animate the continue button + * interaction and navigation items. This is used to disable the animation during testing because + * Espresso has known problems while testing views that contain animations. + */ +@Qualifier +annotation class EnableContinueButtonAnimation + +/** Default value for whether to enable continue button animation. */ +const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true + +/** + * Qualifier to keep track of the sync status of the [EnableContinueButtonAnimation] and help + * determine if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableContinueButtonAnimationIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableContinueButtonAnimationIsServerProvided]. + */ +const val FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** Qualifier for the feature flag corresponding to enabling the spotlight UI. */ +@Qualifier +annotation class EnableSpotlightUi + +/** Default value for the feature flag corresponding to [EnableSpotlightUi]. */ +const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableSpotlightUi] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableSpotlightUiIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableSpotlightUiIsServerProvided]. + */ +const val FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for the feature flag that controls whether input interaction state is correctly + * retained across configuration changes. + */ +@Qualifier +annotation class EnableInteractionConfigChangeStateRetention + +/** + * Default value for feature flag corresponding to [EnableInteractionConfigChangeStateRetention]. + */ +const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableInteractionConfigChangeStateRetention] + * and help determine if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableInteractionConfigChangeStateRetentionIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. + */ +const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Qualifier for the [EnableAppAndOsDeprecation] feature flag that controls whether to enable + * app and OS deprecation or not. + */ +@Qualifier +annotation class EnableAppAndOsDeprecation + +/** + * Default value for the feature flag corresponding to [EnableAppAndOsDeprecation]. + */ +const val ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE = false + +/** + * Qualifier to keep track of the sync status of the [EnableAppAndOsDeprecation] and help determine + * if the value of the feature flag is server-provided or default. + */ +@Qualifier +annotation class FlagEnableAppAndOsDeprecationIsServerProvided + +/** + * Default value for the feature flag sync status tracker corresponding to + * [FlagEnableAppAndOsDeprecationIsServerProvided]. + */ +const val FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt index 8cb1e1b4297..46121ebf7d9 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt @@ -10,15 +10,6 @@ import javax.inject.Qualifier * - Platform Parameter Default Value */ -/** - * Qualifier for the platform parameter that controls whether the user has support for manually - * downloading topics. - */ -@Qualifier annotation class EnableDownloadsSupport - -/** Default value for feature flag corresponding to [EnableDownloadsSupport]. */ -const val ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE = false - /** * Name of the platform parameter that automatically updates topics when a user toggles the * switch in the [AdministratorControlsFragmentPresenter]. @@ -75,72 +66,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. - */ -@Qualifier -annotation class EnableExtraTopicTabsUi - -/** Default value for the feature flag corresponding to [EnableExtraTopicTabsUi]. */ -const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false - -/** - * Qualifier for the platform parameter that controls the visibility of [ProfileAndDeviceIdActivity] - * and working of learner study related analytics logging. - */ -@Qualifier -annotation class EnableLearnerStudyAnalytics - -/** - * Name of the platform parameter that controls the visibility of [ProfileAndDeviceIdActivity] - * and working of learner study related analytics logging. - */ -const val LEARNER_STUDY_ANALYTICS = "learner_study_analytics" - -/** - * Default value of the platform parameter that controls the visibility of [ProfileAndDeviceIdActivity] - * and working of learner study related analytics logging. - */ -const val LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE = false - -/** - * Qualifier for a feature flag that controls whether learners may be allowed (via an - * admin-controlled setting) to use a special in-lesson button for quickly switching between content - * languages. - * - * This is generally expected to only be used in tandem with [EnableLearnerStudyAnalytics]. - */ -@Qualifier annotation class EnableFastLanguageSwitchingInLesson - -/** The platform parameter name corresponding to [EnableFastLanguageSwitchingInLesson]. */ -const val FAST_LANGUAGE_SWITCHING_IN_LESSON = "fast_language_switching_in_lesson" - -/** - * The default enabled state for the feature corresponding to [EnableFastLanguageSwitchingInLesson]. - */ -const val FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE = false - -/** - * Qualifier for a feature flag that controls whether learner study IDs should be generated and - * logged with outgoing events. - * - * This is generally expected to only be used in tandem with [EnableLearnerStudyAnalytics]. - */ -@Qualifier annotation class EnableLoggingLearnerStudyIds - -/** The platform parameter name corresponding to [EnableLoggingLearnerStudyIds]. */ -const val LOGGING_LEARNER_STUDY_IDS = "logging_learner_study_ids" - -/** The default enabled state for the feature corresponding to [EnableLoggingLearnerStudyIds]. */ -const val LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE = false - /** * Qualifier for the platform parameter that controls whether to cache LaTeX rendering using Glide. */ @@ -153,34 +78,6 @@ const val CACHE_LATEX_RENDERING = "cache_latex_rendering" /** Default value for whether to cache LaTeX rendering using Glide. */ const val CACHE_LATEX_RENDERING_DEFAULT_VALUE = true -/** Qualifier for the feature flag corresponding to enabling the edit accounts options. */ -@Qualifier -annotation class EnableEditAccountsOptionsUi - -/** Default value for the feature flag corresponding to [EnableEditAccountsOptionsUi]. */ -const val ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE = false - -/** Qualifier for the platform parameter that controls whether to record performance metrics. */ -@Qualifier -annotation class EnablePerformanceMetricsCollection - -/** Name of the platform parameter that controls whether to record performance metrics. */ -const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_collection" - -/** Default value for whether to record performance metrics. */ -const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false - -/** - * Qualifier for the platform parameter that controls whether to animate the continue button - * interaction and navigation items. This is used to disable the animation during testing because - * Espresso has known problems while testing views that contain animations. - */ -@Qualifier -annotation class EnableContinueButtonAnimation - -/** Default value for whether to enable continue button animation. */ -const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true - /** * Qualifier for the platform parameter that controls the time interval in minutes of uploading * previously recorded performance metrics to the remote service. @@ -243,37 +140,6 @@ const val PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES const val PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL = 1440 -/** Qualifier for the feature flag corresponding to enabling the spotlight UI. */ -@Qualifier -annotation class EnableSpotlightUi - -/** Default value for the feature flag corresponding to [EnableSpotlightUi]. */ -const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false - -/** - * Qualifier for the platform parameter that controls whether input interaction state is correctly - * retained across configuration changes. - */ -@Qualifier -annotation class EnableInteractionConfigChangeStateRetention - -/** - * Default value for feature flag corresponding to [EnableInteractionConfigChangeStateRetention]. - */ -const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false - -/** - * Qualifier for the [EnableAppAndOsDeprecation] feature flag that controls whether to enable - * app and OS deprecation or not. - */ -@Qualifier -annotation class EnableAppAndOsDeprecation - -/** - * Default value for the feature flag corresponding to [EnableAppAndOsDeprecation]. - */ -const val ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE = false - /** * Qualifier for the platform parameter that contains the version code of the latest available * optional app update, which is used to notify the app that a soft update is available. From 9c09fbf1a81aaceef1e8aff529293147b9cc26f3 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 18 Oct 2023 12:28:58 +0300 Subject: [PATCH 02/20] feat: Add constant names for easy retrieval of the feature flags from persistent cache store --- .../platformparameter/FeatureFlagConstants.kt | 72 ++++++++++++++++--- 1 file changed, 63 insertions(+), 9 deletions(-) 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 a4de5f115d2..5dd54fae4ea 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 @@ -28,6 +28,10 @@ const val ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableDownloadsSupportIsServerProvided +/** The feature flag name corresponding to [FlagEnableDownloadsSupportIsServerProvided]. */ +const val FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED = + "flag_enable_downloads_support_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableDownloadsSupportIsServerProvided]. @@ -48,6 +52,10 @@ const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = true @Qualifier annotation class FlagEnableLanguageSelectionUiIsServerProvided +/** The feature flag name corresponding to [FlagEnableLanguageSelectionUiIsServerProvided]. */ +const val FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED = + "flag_enable_language_selection_ui_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableLanguageSelectionUiIsServerProvided]. @@ -70,6 +78,10 @@ const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableExtraTopicTabsUiIsServerProvided +/** The feature flag name corresponding to [FlagEnableExtraTopicTabsUiIsServerProvided]. */ +const val FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED = + "flag_enable_extra_topic_tabs_ui_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableExtraTopicTabsUiIsServerProvided]. @@ -96,12 +108,16 @@ const val LEARNER_STUDY_ANALYTICS = "learner_study_analytics" const val LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE = false /** - * Qualifier to keep track of the sync status of the [EnableLearnerStudyAnalytics] and help determine - * if the value of the feature flag is server-provided or default. + * Qualifier to keep track of the sync status of the [EnableLearnerStudyAnalytics] and help + * determine if the value of the feature flag is server-provided or default. */ @Qualifier annotation class FlagEnableLearnerStudyAnalyticsIsServerProvided +/** The feature flag name corresponding to [FlagEnableLearnerStudyAnalyticsIsServerProvided]. */ +const val FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED = + "flag_enable_learner_study_analytics_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableLearnerStudyAnalyticsIsServerProvided]. @@ -126,12 +142,18 @@ const val FAST_LANGUAGE_SWITCHING_IN_LESSON = "fast_language_switching_in_lesson const val FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE = false /** - * Qualifier to keep track of the sync status of the [EnableFastLanguageSwitchingInLesson] and help determine - * if the value of the feature flag is server-provided or default. + * Qualifier to keep track of the sync status of the [EnableFastLanguageSwitchingInLesson] and help + * determine if the value of the feature flag is server-provided or default. */ @Qualifier annotation class FlagEnableFastLanguageSwitchingInLessonIsServerProvided +/** The feature flag name corresponding to + * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. + */ +const val FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED = + "flag_enable_fast_language_switching_in_lesson_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. @@ -153,12 +175,16 @@ const val LOGGING_LEARNER_STUDY_IDS = "logging_learner_study_ids" const val LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE = false /** - * Qualifier to keep track of the sync status of the [EnableLoggingLearnerStudyIds] and help determine - * if the value of the feature flag is server-provided or default. + * Qualifier to keep track of the sync status of the [EnableLoggingLearnerStudyIds] and help + * determine if the value of the feature flag is server-provided or default. */ @Qualifier annotation class FlagEnableLoggingLearnerStudyIdsIsServerProvided +/** The feature flag name corresponding to [FlagEnableLoggingLearnerStudyIdsIsServerProvided]. */ +const val FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED = + "flag_enable_logging_learner_study_ids_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableLoggingLearnerStudyIdsIsServerProvided]. @@ -173,12 +199,16 @@ annotation class EnableEditAccountsOptionsUi const val ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE = false /** - * Qualifier to keep track of the sync status of the [EnableEditAccountsOptionsUi] and help determine - * if the value of the feature flag is server-provided or default. + * Qualifier to keep track of the sync status of the [EnableEditAccountsOptionsUi] and help + * determine if the value of the feature flag is server-provided or default. */ @Qualifier annotation class FlagEnableEditAccountsOptionsUiIsServerProvided +/** The feature flag name corresponding to [FlagEnableEditAccountsOptionsUiIsServerProvided]. */ +const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED = + "flag_enable_edit_accounts_options_ui_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableEditAccountsOptionsUiIsServerProvided]. @@ -202,6 +232,11 @@ const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false @Qualifier annotation class FlagEnablePerformanceMetricsCollectionIsServerProvided +/** The feature flag name corresponding to [FlagEnablePerformanceMetricsCollectionIsServerProvided]. + */ +const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED = + "flag_enable_performance_metrics_collection_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnablePerformanceMetricsCollectionIsServerProvided]. @@ -226,6 +261,10 @@ const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true @Qualifier annotation class FlagEnableContinueButtonAnimationIsServerProvided +/** The feature flag name corresponding to [FlagEnableContinueButtonAnimationIsServerProvided]. */ +const val FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED = + "flag_enable_continue_button_animation_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableContinueButtonAnimationIsServerProvided]. @@ -246,6 +285,10 @@ const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableSpotlightUiIsServerProvided +/** The feature flag name corresponding to [FlagEnableSpotlightUiIsServerProvided]. */ +const val FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED = + "flag_enable_spotlight_ui_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableSpotlightUiIsServerProvided]. @@ -271,11 +314,18 @@ const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableInteractionConfigChangeStateRetentionIsServerProvided +/** The feature flag name corresponding to + * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. + */ +const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED = + "flag_enable_interaction_config_change_state_retention_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. */ -const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false +const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = + false /** * Qualifier for the [EnableAppAndOsDeprecation] feature flag that controls whether to enable @@ -296,6 +346,10 @@ const val ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableAppAndOsDeprecationIsServerProvided +/** The feature flag name corresponding to [FlagEnableAppAndOsDeprecationIsServerProvided]. */ +const val FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED = + "flag_enable_app_and_os_deprecation_is_server_provided" + /** * Default value for the feature flag sync status tracker corresponding to * [FlagEnableAppAndOsDeprecationIsServerProvided]. From b0d15724f39aabf04356c2d378b9d1af74983216 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 18 Oct 2023 13:03:39 +0300 Subject: [PATCH 03/20] feat: Add newly status flags to the Platform Parameter dependency modules --- .../PlatformParameterAlphaKenyaModule.kt | 165 ++++++++++++++++++ .../PlatformParameterAlphaModule.kt | 165 ++++++++++++++++++ .../PlatformParameterModule.kt | 165 ++++++++++++++++++ 3 files changed, 495 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 1b3293d56f5..c96261b5d8d 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 @@ -30,7 +30,40 @@ import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds 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 +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE +import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS @@ -75,6 +108,18 @@ class PlatformParameterAlphaKenyaModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + @Provides + @FlagEnableDownloadsSupportIsServerProvided + fun provideFlagEnableDownloadsSupportIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -104,6 +149,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableLanguageSelectionUiIsServerProvided + fun provideFlagEnableLanguageSelectionUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -122,6 +179,18 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } + @Provides + @FlagEnableLearnerStudyAnalyticsIsServerProvided + fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -132,6 +201,18 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } + @Provides + @FlagEnableFastLanguageSwitchingInLessonIsServerProvided + fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -142,6 +223,18 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } + @Provides + @FlagEnableLoggingLearnerStudyIdsIsServerProvided + fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -163,6 +256,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnablePerformanceMetricsCollectionIsServerProvided + fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -207,6 +312,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableExtraTopicTabsUiIsServerProvided + fun provideFlagEnableExtraTopicTabsUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -215,6 +332,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided + fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -223,6 +352,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableContinueButtonAnimationIsServerProvided + fun provideFlagEnableContinueButtonAnimationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableSpotlightUi fun enableSpotlightUi(): PlatformParameterValue { @@ -231,6 +372,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableSpotlightUiIsServerProvided + fun provideFlagEnableSpotlightUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -239,6 +392,18 @@ class PlatformParameterAlphaKenyaModule { ) } + @Provides + @FlagEnableAppAndOsDeprecationIsServerProvided + fun provideFlagEnableAppAndOsDeprecationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( 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 8addae7b9fd..0781615bdee 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 @@ -30,7 +30,40 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE +import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS @@ -72,6 +105,18 @@ class PlatformParameterAlphaModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + @Provides + @FlagEnableDownloadsSupportIsServerProvided + fun provideFlagEnableDownloadsSupportIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -101,6 +146,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableLanguageSelectionUiIsServerProvided + fun provideFlagEnableLanguageSelectionUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -118,6 +175,18 @@ class PlatformParameterAlphaModule { ?: PlatformParameterValue.createDefaultParameter(true) } + @Provides + @FlagEnableLearnerStudyAnalyticsIsServerProvided + fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -129,6 +198,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableFastLanguageSwitchingInLessonIsServerProvided + fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -138,6 +219,18 @@ class PlatformParameterAlphaModule { ?: PlatformParameterValue.createDefaultParameter(LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE) } + @Provides + @FlagEnableLoggingLearnerStudyIdsIsServerProvided + fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -159,6 +252,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnablePerformanceMetricsCollectionIsServerProvided + fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -200,6 +305,18 @@ class PlatformParameterAlphaModule { fun provideEnableSpotlightUi(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(true) // Enable spotlights for alpha users. + @Provides + @FlagEnableSpotlightUiIsServerProvided + fun provideFlagEnableSpotlightUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableExtraTopicTabsUi fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { @@ -208,6 +325,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableExtraTopicTabsUiIsServerProvided + fun provideFlagEnableExtraTopicTabsUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -216,6 +345,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided + fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -224,6 +365,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableContinueButtonAnimationIsServerProvided + fun provideFlagEnableContinueButtonAnimationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -232,6 +385,18 @@ class PlatformParameterAlphaModule { ) } + @Provides + @FlagEnableAppAndOsDeprecationIsServerProvided + fun provideFlagEnableAppAndOsDeprecationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( 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 c2a211472fc..596987f39c2 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 @@ -31,7 +31,40 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED +import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE +import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided +import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE @@ -74,6 +107,18 @@ class PlatformParameterModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + @Provides + @FlagEnableDownloadsSupportIsServerProvided + fun provideFlagEnableDownloadsSupportIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -103,6 +148,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableLanguageSelectionUiIsServerProvided + fun provideFlagEnableLanguageSelectionUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -120,6 +177,18 @@ class PlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE) } + @Provides + @FlagEnableLearnerStudyAnalyticsIsServerProvided + fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -131,6 +200,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableFastLanguageSwitchingInLessonIsServerProvided + fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -140,6 +221,18 @@ class PlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE) } + @Provides + @FlagEnableLoggingLearnerStudyIdsIsServerProvided + fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -161,6 +254,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnablePerformanceMetricsCollectionIsServerProvided + fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -205,6 +310,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableSpotlightUiIsServerProvided + fun provideFlagEnableSpotlightUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableExtraTopicTabsUi fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { @@ -213,6 +330,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableExtraTopicTabsUiIsServerProvided + fun provideFlagEnableExtraTopicTabsUiIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -221,6 +350,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided + fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -229,6 +370,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableContinueButtonAnimationIsServerProvided + fun provideFlagEnableContinueButtonAnimationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -237,6 +390,18 @@ class PlatformParameterModule { ) } + @Provides + @FlagEnableAppAndOsDeprecationIsServerProvided + fun provideFlagEnableAppAndOsDeprecationIsServerProvided( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( From 7e135308f2212ff7514dfc669341650b2ce9de91 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Fri, 20 Oct 2023 14:29:02 +0300 Subject: [PATCH 04/20] feat: Add ability to insert sync statuses to the cache store --- .../PlatformParameterModule.kt | 28 +++++++++---------- .../syncup/PlatformParameterSyncUpWorker.kt | 28 +++++++++++++++++-- 2 files changed, 40 insertions(+), 16 deletions(-) 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 596987f39c2..b7c83c3734c 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 @@ -185,7 +185,7 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE + FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE ) } @@ -208,8 +208,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides @@ -229,8 +229,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides @@ -262,8 +262,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides @@ -318,8 +318,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides @@ -338,8 +338,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides @@ -378,7 +378,7 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE ) } @@ -398,8 +398,8 @@ class PlatformParameterModule { return platformParameterSingleton.getBooleanPlatformParameter( FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) + FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) } @Provides diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index aaf5aad0a0d..f631909e5b5 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -111,11 +111,14 @@ class PlatformParameterSyncUpWorker private constructor( if (response != null) { val responseBody = checkNotNull(response.body()) val platformParameterList = parseNetworkResponse(responseBody) - if (platformParameterList.isEmpty()) { + + // Add boolean flags + val platformParameterListWithSyncStatusFlags = addSyncStatusFlags(platformParameterList) + if (platformParameterListWithSyncStatusFlags.isEmpty()) { throw IllegalArgumentException(EMPTY_RESPONSE_EXCEPTION_MSG) } val cachingResult = platformParameterController - .updatePlatformParameterDatabase(platformParameterList) + .updatePlatformParameterDatabase(platformParameterListWithSyncStatusFlags) .retrieveData() if (cachingResult is AsyncResult.Failure) { throw IllegalStateException(cachingResult.error) @@ -132,6 +135,27 @@ class PlatformParameterSyncUpWorker private constructor( } } + private fun addSyncStatusFlags( + platformParameterList: List + ): List { + val modifiedList = mutableListOf() + + for (param in platformParameterList) { + modifiedList.add(param) + + val syncStatusParamKey = "flag_" + param.name + "_is_server_provided" + + // Add it to the modified list + val paramSyncStatusTracker = PlatformParameter.newBuilder().setName(syncStatusParamKey) + paramSyncStatusTracker.boolean = true + paramSyncStatusTracker.build() + + modifiedList.add(paramSyncStatusTracker.build()) + } + + return modifiedList + } + /** Creates an instance of [PlatformParameterSyncUpWorker] by properly injecting dependencies. */ class Factory @Inject constructor( private val platformParameterController: PlatformParameterController, From 6c06ea5e63b19b1d3a667e57f5d86cda0474522c Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Mon, 23 Oct 2023 20:32:20 +0300 Subject: [PATCH 05/20] feat: Add ability to save flag statuses for every feature flag --- .../PlatformParameterSyncUpWorkerTest.kt | 47 +++++++++++++++++++ .../TestStringPlatformParameter.kt | 15 ++++++ 2 files changed, 62 insertions(+) diff --git a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt index ad16b301201..a6be2e71aaf 100644 --- a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt @@ -50,6 +50,8 @@ import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_SERVER_VALUE import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SERVER_VALUE +import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME +import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -112,6 +114,11 @@ class PlatformParameterSyncUpWorkerTest { .setBoolean(TEST_BOOLEAN_PARAM_SERVER_VALUE) .build() + private val expectedTestStringParameterFlagStatus = PlatformParameter.newBuilder() + .setName(TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME) + .setBoolean(TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE) + .build() + // Not including "expectedTestBooleanParameter" in this list to prove that a refresh took place private val mockPlatformParameterList = listOf( expectedTestStringParameter, @@ -322,6 +329,46 @@ class PlatformParameterSyncUpWorkerTest { .containsEntry(TEST_INTEGER_PARAM_NAME, defaultTestIntegerParameter) } + @Test + fun testSyncUpWorker_getFeatureFlags_addSyncStatusFlags_verifyCorrectStatusReturned() { + // Set up versionName to get correct network response from mock platform parameter service. + setUpApplicationForContext(MockPlatformParameterService.appVersionForCorrectResponse) + + // Empty the Platform Parameter Database to simulate the execution of first SyncUp Work request. + platformParameterController.updatePlatformParameterDatabase(listOf()) + + val workManager = WorkManager.getInstance(context) + + val inputData = Data.Builder().putString( + PlatformParameterSyncUpWorker.WORKER_TYPE_KEY, + PlatformParameterSyncUpWorker.PLATFORM_PARAMETER_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + // Enqueue the Work Request to fetch and cache the Platform Parameters from Remote Service. + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + + val workInfo = workManager.getWorkInfoById(request.id) + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) + + // Retrieve the previously cached Platform Parameters from Cache Store. + monitorFactory.ensureDataProviderExecutes(platformParameterController.getParameterDatabase()) + + // Values retrieved from Cache store will be sent to Platform Parameter Singleton by the + // Controller in the form of a Map, therefore verify the retrieved values from that Map. + val platformParameterMap = platformParameterSingleton.getPlatformParameterMap() + assertThat(platformParameterMap) + .containsEntry(TEST_STRING_PARAM_NAME, expectedTestStringParameter) + + val platformParameterMapFlagStatus = platformParameterSingleton.getPlatformParameterMap() + assertThat(platformParameterMapFlagStatus) + .containsEntry(TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME, expectedTestStringParameterFlagStatus) + } + private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) } diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt index 330623e1ba4..9af3f8e52f2 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt @@ -22,3 +22,18 @@ const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" * Server value for the test string platform parameter. Only used in tests related to platform parameter. */ const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" + +/** + * Name for the test string platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME = "flag_test_string_param_name_is_server_provided" + +/** + * Default value for the test string platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_DEFAULT_VALUE = false + +/** + * Server value for the test string platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true From 1f0fa64a3a488e7aeec0578ae3d026f6ab055813 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Mon, 23 Oct 2023 23:30:07 +0300 Subject: [PATCH 06/20] fix: Fix linting and styling checks --- scripts/assets/test_file_exemptions.textproto | 1 + .../util/platformparameter/FeatureFlagConstants.kt | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index 699f8b9a9cd..25e29b480cc 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -880,6 +880,7 @@ exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/svg/Svg exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/svg/SvgDecoder.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/svg/SvgPictureDrawable.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/parser/svg/TextSvgDrawableTranscoder.kt" +exempted_file_path: "utility/src/main/java/org/oppia/android/util/platformparameter/FeatureFlagConstants.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterConstants.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt" exempted_file_path: "utility/src/main/java/org/oppia/android/util/statusbar/StatusBarColor.kt" 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 5dd54fae4ea..0550c4db2d3 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 @@ -148,7 +148,8 @@ const val FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableFastLanguageSwitchingInLessonIsServerProvided -/** The feature flag name corresponding to +/** + * The feature flag name corresponding to * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. */ const val FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED = @@ -232,7 +233,8 @@ const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false @Qualifier annotation class FlagEnablePerformanceMetricsCollectionIsServerProvided -/** The feature flag name corresponding to [FlagEnablePerformanceMetricsCollectionIsServerProvided]. +/** + * The feature flag name corresponding to [FlagEnablePerformanceMetricsCollectionIsServerProvided]. */ const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED = "flag_enable_performance_metrics_collection_is_server_provided" @@ -314,7 +316,8 @@ const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false @Qualifier annotation class FlagEnableInteractionConfigChangeStateRetentionIsServerProvided -/** The feature flag name corresponding to +/** + * The feature flag name corresponding to * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. */ const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED = From 795e90c2a8e39ee022204f46f8e58d32ccf3d8f2 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Fri, 27 Oct 2023 00:33:59 +0300 Subject: [PATCH 07/20] fix: Fix comments made on the previous review --- .../syncup/PlatformParameterSyncUpWorker.kt | 13 +++++------- .../PlatformParameterSyncUpWorkerTest.kt | 13 +++++------- .../TestPlatformParameterModule.kt | 13 ++++++++++++ .../TestStringPlatformParameter.kt | 20 ++++++++++++------- .../platformparameter/FeatureFlagConstants.kt | 8 ++++---- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index f631909e5b5..189b421cfc3 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -112,8 +112,7 @@ class PlatformParameterSyncUpWorker private constructor( val responseBody = checkNotNull(response.body()) val platformParameterList = parseNetworkResponse(responseBody) - // Add boolean flags - val platformParameterListWithSyncStatusFlags = addSyncStatusFlags(platformParameterList) + val platformParameterListWithSyncStatusFlags = platformParameterList.addSyncStatusFlags() if (platformParameterListWithSyncStatusFlags.isEmpty()) { throw IllegalArgumentException(EMPTY_RESPONSE_EXCEPTION_MSG) } @@ -135,18 +134,16 @@ class PlatformParameterSyncUpWorker private constructor( } } - private fun addSyncStatusFlags( - platformParameterList: List - ): List { + private fun List.addSyncStatusFlags(): List { val modifiedList = mutableListOf() - for (param in platformParameterList) { + for (param in this) { modifiedList.add(param) - val syncStatusParamKey = "flag_" + param.name + "_is_server_provided" - // Add it to the modified list val paramSyncStatusTracker = PlatformParameter.newBuilder().setName(syncStatusParamKey) + // Update the boolean status of the derived syncStatusParamKey to true. This is necessary + // since sync status flags are local only and don't have a preset value. paramSyncStatusTracker.boolean = true paramSyncStatusTracker.build() diff --git a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt index a6be2e71aaf..aca0317b11e 100644 --- a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt @@ -43,6 +43,7 @@ import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.data.DataProviderTestMonitor import org.oppia.android.testing.network.MockPlatformParameterService import org.oppia.android.testing.network.RetrofitTestModule +import org.oppia.android.testing.platformparameter.FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED import org.oppia.android.testing.platformparameter.TEST_BOOLEAN_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_BOOLEAN_PARAM_SERVER_VALUE import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_DEFAULT_VALUE @@ -50,7 +51,6 @@ import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_SERVER_VALUE import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SERVER_VALUE -import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers @@ -115,7 +115,7 @@ class PlatformParameterSyncUpWorkerTest { .build() private val expectedTestStringParameterFlagStatus = PlatformParameter.newBuilder() - .setName(TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME) + .setName(FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED) .setBoolean(TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE) .build() @@ -360,13 +360,10 @@ class PlatformParameterSyncUpWorkerTest { // Values retrieved from Cache store will be sent to Platform Parameter Singleton by the // Controller in the form of a Map, therefore verify the retrieved values from that Map. - val platformParameterMap = platformParameterSingleton.getPlatformParameterMap() - assertThat(platformParameterMap) - .containsEntry(TEST_STRING_PARAM_NAME, expectedTestStringParameter) - val platformParameterMapFlagStatus = platformParameterSingleton.getPlatformParameterMap() - assertThat(platformParameterMapFlagStatus) - .containsEntry(TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME, expectedTestStringParameterFlagStatus) + assertThat(platformParameterMapFlagStatus).containsEntry( + FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED, expectedTestStringParameterFlagStatus + ) } private fun setUpTestApplicationComponent() { 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 7ff02772a65..fe3b23d9cee 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 @@ -99,6 +99,19 @@ class TestPlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(TEST_BOOLEAN_PARAM_DEFAULT_VALUE) } + @TestStringParam + @Provides + @Singleton + fun provideFlagTestStringParam( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED + ) ?: PlatformParameterValue.createDefaultParameter( + FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE + ) + } + @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt index 9af3f8e52f2..e50a9a52a01 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt @@ -14,26 +14,32 @@ annotation class TestStringParam const val TEST_STRING_PARAM_NAME = "test_string_param_name" /** - * Default value for the test string platform parameter. Only used in tests related to platform parameter. + * Default value for the test string platform parameter. Only used in tests related to platform + * parameter. */ const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" /** - * Server value for the test string platform parameter. Only used in tests related to platform parameter. + * Server value for the test string platform parameter. Only used in tests related to platform + * parameter. */ const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" /** - * Name for the test string platform parameter. Only used in tests related to platform parameter. + * Feature flag sync status name for the test string platform parameter. This name helps retrieve + * the sync status of the [TestStringParam]. Only used in tests related to platform parameter. */ -const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_NAME = "flag_test_string_param_name_is_server_provided" +const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED = + "flag_test_string_param_name_is_server_provided" /** - * Default value for the test string platform parameter. Only used in tests related to platform parameter. + * Default value for the feature flag sync status tracker for the [TestStringParam]. Only used in + * tests related to platform parameter. */ -const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_DEFAULT_VALUE = false +const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE = false /** - * Server value for the test string platform parameter. Only used in tests related to platform parameter. + * Server value for the test string platform parameter. Only used in tests related to platform + * parameter. */ const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true 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 0550c4db2d3..b7045b20772 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 @@ -9,7 +9,7 @@ import javax.inject.Qualifier * - Feature Flag Name - The name begins with Enable_ * - Feature Flag Default Value * - Feature Flag Status - A boolean that keeps track of whether the feature flag - * has been synced with Oppia Web or not. + * has been synced with Oppia Web. */ /** @@ -216,11 +216,11 @@ const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED = */ const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false -/** Qualifier for the platform parameter that controls whether to record performance metrics. */ +/** Qualifier for the feature flag that controls whether to record performance metrics. */ @Qualifier annotation class EnablePerformanceMetricsCollection -/** Name of the platform parameter that controls whether to record performance metrics. */ +/** Name of the feature flag that controls whether to record performance metrics. */ const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_collection" /** Default value for whether to record performance metrics. */ @@ -246,7 +246,7 @@ const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED = const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false /** - * Qualifier for the platform parameter that controls whether to animate the continue button + * Qualifier for the feature flag that controls whether to animate the continue button * interaction and navigation items. This is used to disable the animation during testing because * Espresso has known problems while testing views that contain animations. */ From 9da1607fcefe86b949b31fb98667a6de969596de Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Sun, 29 Oct 2023 20:42:00 +0300 Subject: [PATCH 08/20] fix: Fix nit Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com> --- .../syncup/PlatformParameterSyncUpWorker.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index 189b421cfc3..cbe095c65af 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -134,20 +134,19 @@ class PlatformParameterSyncUpWorker private constructor( } } - private fun List.addSyncStatusFlags(): List { + private fun List.addSyncStatusFlags(): List { val modifiedList = mutableListOf() for (param in this) { modifiedList.add(param) val syncStatusParamKey = "flag_" + param.name + "_is_server_provided" - val paramSyncStatusTracker = PlatformParameter.newBuilder().setName(syncStatusParamKey) - // Update the boolean status of the derived syncStatusParamKey to true. This is necessary - // since sync status flags are local only and don't have a preset value. - paramSyncStatusTracker.boolean = true - paramSyncStatusTracker.build() - - modifiedList.add(paramSyncStatusTracker.build()) + val paramSyncStatusTracker = PlatformParameter.newBuilder().apply { + name =syncStatusParamKey + boolean = true // Indicates that sync status flags are up to date since they are local only + } + .build() + modifiedList.add(paramSyncStatusTracker) } return modifiedList From 4dae83c13d7f13585b877ec14ae5072542d41708 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Mon, 30 Oct 2023 11:02:49 +0300 Subject: [PATCH 09/20] fix: Fix lint issues causing build failure --- .../syncup/PlatformParameterSyncUpWorker.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index cbe095c65af..645012e1f79 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -134,15 +134,15 @@ class PlatformParameterSyncUpWorker private constructor( } } - private fun List.addSyncStatusFlags(): List { + private fun List.addSyncStatusFlags(): List { val modifiedList = mutableListOf() for (param in this) { modifiedList.add(param) - val syncStatusParamKey = "flag_" + param.name + "_is_server_provided" + val syncStatusParamName = "flag_" + param.name + "_is_server_provided" - val paramSyncStatusTracker = PlatformParameter.newBuilder().apply { - name =syncStatusParamKey + val paramSyncStatusTracker = PlatformParameter.newBuilder().apply { + name = syncStatusParamName boolean = true // Indicates that sync status flags are up to date since they are local only } .build() From 81d968b9559ef6c13f3db94fae1672a02ee88837 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Mon, 30 Oct 2023 22:24:58 +0300 Subject: [PATCH 10/20] fix: Move test sync status flag booleans to the TestBooleanPlatformParameter file --- .../TestBooleanPlatformParameter.kt | 19 +++++++++++++++++++ .../TestStringPlatformParameter.kt | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt index de74d381739..2130e26e834 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt @@ -22,3 +22,22 @@ const val TEST_BOOLEAN_PARAM_DEFAULT_VALUE = false * Server value for the test boolean platform parameter. Only used in tests related to platform parameter. */ const val TEST_BOOLEAN_PARAM_SERVER_VALUE = true + +/** + * Feature flag sync status name for the test string platform parameter. This name helps retrieve + * the sync status of the [TestStringParam]. Only used in tests related to platform parameter. + */ +const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED = + "flag_test_string_param_name_is_server_provided" + +/** + * Default value for the feature flag sync status tracker for the [TestStringParam]. Only used in + * tests related to platform parameter. + */ +const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE = false + +/** + * Server value for the test string platform parameter. Only used in tests related to platform + * parameter. + */ +const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt index e50a9a52a01..6c5e01c0d95 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt @@ -24,22 +24,3 @@ const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" * parameter. */ const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" - -/** - * Feature flag sync status name for the test string platform parameter. This name helps retrieve - * the sync status of the [TestStringParam]. Only used in tests related to platform parameter. - */ -const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED = - "flag_test_string_param_name_is_server_provided" - -/** - * Default value for the feature flag sync status tracker for the [TestStringParam]. Only used in - * tests related to platform parameter. - */ -const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - -/** - * Server value for the test string platform parameter. Only used in tests related to platform - * parameter. - */ -const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true From d8f14bd763cd7250972bb4c9a17ef8599ee04a04 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 1 Nov 2023 09:55:14 +0300 Subject: [PATCH 11/20] chore: Move all test constants from individual type-organized files to a common constants file --- .../testing/platformparameter/BUILD.bazel | 4 +- .../TestIntegerPlatformParameter.kt | 24 -------- ...r.kt => TestPlatformParameterConstants.kt} | 60 ++++++++++++++++--- .../TestPlatformParameterModule.kt | 1 - .../TestStringPlatformParameter.kt | 26 -------- 5 files changed, 53 insertions(+), 62 deletions(-) delete mode 100644 testing/src/main/java/org/oppia/android/testing/platformparameter/TestIntegerPlatformParameter.kt rename testing/src/main/java/org/oppia/android/testing/platformparameter/{TestBooleanPlatformParameter.kt => TestPlatformParameterConstants.kt} (51%) delete mode 100644 testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/BUILD.bazel b/testing/src/main/java/org/oppia/android/testing/platformparameter/BUILD.bazel index a724de2135e..2ef5618b8fc 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/BUILD.bazel +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/BUILD.bazel @@ -10,9 +10,7 @@ kt_android_library( name = "test_constants", testonly = True, srcs = [ - "TestBooleanPlatformParameter.kt", - "TestIntegerPlatformParameter.kt", - "TestStringPlatformParameter.kt", + "TestPlatformParameterConstants.kt", ], visibility = [ "//:oppia_testing_visibility", diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestIntegerPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestIntegerPlatformParameter.kt deleted file mode 100644 index 956d3f1d4e0..00000000000 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestIntegerPlatformParameter.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.oppia.android.testing.platformparameter - -import javax.inject.Qualifier - -/** - * Qualifier for test integer platform parameter. Only used in tests related to platform parameter. - */ -@Qualifier -annotation class TestIntegerParam - -/** - * Name for the test integer platform parameter. Only used in tests related to platform parameter. - */ -const val TEST_INTEGER_PARAM_NAME = "test_integer_param_name" - -/** - * Default value for the test integer platform parameter. Only used in tests related to platform parameter. - */ -const val TEST_INTEGER_PARAM_DEFAULT_VALUE = 0 - -/** - * Server value for the test integer platform parameter. Only used in tests related to platform parameter. - */ -const val TEST_INTEGER_PARAM_SERVER_VALUE = 1 diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt similarity index 51% rename from testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt rename to testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt index 2130e26e834..567184a9bdd 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt @@ -3,25 +3,27 @@ package org.oppia.android.testing.platformparameter import javax.inject.Qualifier /** - * Qualifier for test boolean platform parameter. Only used in tests related to platform parameter. + * Qualifier for test string platform parameter. Only used in tests related to platform parameter. */ @Qualifier -annotation class TestBooleanParam +annotation class TestStringParam /** - * Name for the test boolean platform parameter. Only used in tests related to platform parameter. + * Name for the test string platform parameter. Only used in tests related to platform parameter. */ -const val TEST_BOOLEAN_PARAM_NAME = "test_boolean_param_name" +const val TEST_STRING_PARAM_NAME = "test_string_param_name" /** - * Default value for the test boolean platform parameter. Only used in tests related to platform parameter. + * Default value for the test string platform parameter. Only used in tests related to platform + * parameter. */ -const val TEST_BOOLEAN_PARAM_DEFAULT_VALUE = false +const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" /** - * Server value for the test boolean platform parameter. Only used in tests related to platform parameter. + * Server value for the test string platform parameter. Only used in tests related to platform + * parameter. */ -const val TEST_BOOLEAN_PARAM_SERVER_VALUE = true +const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" /** * Feature flag sync status name for the test string platform parameter. This name helps retrieve @@ -41,3 +43,45 @@ const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE = false * parameter. */ const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true + +/** + * Qualifier for test boolean platform parameter. Only used in tests related to platform parameter. + */ +@Qualifier +annotation class TestBooleanParam + +/** + * Name for the test boolean platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_BOOLEAN_PARAM_NAME = "test_boolean_param_name" + +/** + * Default value for the test boolean platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_BOOLEAN_PARAM_DEFAULT_VALUE = false + +/** + * Server value for the test boolean platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_BOOLEAN_PARAM_SERVER_VALUE = true + +/** + * Qualifier for test integer platform parameter. Only used in tests related to platform parameter. + */ +@Qualifier +annotation class TestIntegerParam + +/** + * Name for the test integer platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_INTEGER_PARAM_NAME = "test_integer_param_name" + +/** + * Default value for the test integer platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_INTEGER_PARAM_DEFAULT_VALUE = 0 + +/** + * Server value for the test integer platform parameter. Only used in tests related to platform parameter. + */ +const val TEST_INTEGER_PARAM_SERVER_VALUE = 1 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 fe3b23d9cee..2e0d35203e1 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 @@ -99,7 +99,6 @@ class TestPlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(TEST_BOOLEAN_PARAM_DEFAULT_VALUE) } - @TestStringParam @Provides @Singleton fun provideFlagTestStringParam( diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt deleted file mode 100644 index 6c5e01c0d95..00000000000 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.oppia.android.testing.platformparameter - -import javax.inject.Qualifier - -/** - * Qualifier for test string platform parameter. Only used in tests related to platform parameter. - */ -@Qualifier -annotation class TestStringParam - -/** - * Name for the test string platform parameter. Only used in tests related to platform parameter. - */ -const val TEST_STRING_PARAM_NAME = "test_string_param_name" - -/** - * Default value for the test string platform parameter. Only used in tests related to platform - * parameter. - */ -const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" - -/** - * Server value for the test string platform parameter. Only used in tests related to platform - * parameter. - */ -const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" From 7bcbdcf69f77837de45b48e65fdae12f6908d073 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 1 Nov 2023 13:21:31 +0300 Subject: [PATCH 12/20] fix: Fix failing text file checks --- scripts/assets/test_file_exemptions.textproto | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index 0a4417cd30a..dac453e5d9b 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -798,10 +798,8 @@ exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/Moc exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/MockSubtopicService.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/MockTopicService.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/network/RetrofitTestModule.kt" -exempted_file_path: "testing/src/main/java/org/oppia/android/testing/platformparameter/TestBooleanPlatformParameter.kt" -exempted_file_path: "testing/src/main/java/org/oppia/android/testing/platformparameter/TestIntegerPlatformParameter.kt" +exempted_file_path: "testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterModule.kt" -exempted_file_path: "testing/src/main/java/org/oppia/android/testing/platformparameter/TestStringPlatformParameter.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/robolectric/IsOnRobolectric.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/robolectric/RobolectricModule.kt" exempted_file_path: "testing/src/main/java/org/oppia/android/testing/threading/BackgroundTestDispatcher.kt" From b49df60dd78e40fdbac0a928f8e9cf027950b658 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Tue, 7 Nov 2023 12:51:08 +0300 Subject: [PATCH 13/20] feat: Add a isSynced variable in the platform parameter variable to simplify sync monitoring --- .../PlatformParameterAlphaKenyaModule.kt | 165 -------------- .../PlatformParameterAlphaModule.kt | 165 -------------- .../PlatformParameterModule.kt | 165 -------------- .../PlatformParameterSingletonImpl.kt | 6 + .../syncup/PlatformParameterSyncUpWorker.kt | 25 +- .../domain/audio/AudioPlayerControllerTest.kt | 2 + .../PlatformParameterSyncUpWorkerTest.kt | 65 +++++- .../ProfileManagementControllerTest.kt | 2 + model/src/main/proto/platform_parameter.proto | 2 + .../TestPlatformParameterConstants.kt | 19 -- .../TestPlatformParameterModule.kt | 12 - .../platformparameter/FeatureFlagConstants.kt | 213 ------------------ .../PlatformParameterValue.kt | 9 +- 13 files changed, 77 insertions(+), 773 deletions(-) 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 c96261b5d8d..1b3293d56f5 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 @@ -30,40 +30,7 @@ import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds 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 -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE -import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS @@ -108,18 +75,6 @@ class PlatformParameterAlphaKenyaModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) - @Provides - @FlagEnableDownloadsSupportIsServerProvided - fun provideFlagEnableDownloadsSupportIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -149,18 +104,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableLanguageSelectionUiIsServerProvided - fun provideFlagEnableLanguageSelectionUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -179,18 +122,6 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } - @Provides - @FlagEnableLearnerStudyAnalyticsIsServerProvided - fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -201,18 +132,6 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } - @Provides - @FlagEnableFastLanguageSwitchingInLessonIsServerProvided - fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -223,18 +142,6 @@ class PlatformParameterAlphaKenyaModule { ?: PlatformParameterValue.createDefaultParameter(true) } - @Provides - @FlagEnableLoggingLearnerStudyIdsIsServerProvided - fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -256,18 +163,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnablePerformanceMetricsCollectionIsServerProvided - fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -312,18 +207,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableExtraTopicTabsUiIsServerProvided - fun provideFlagEnableExtraTopicTabsUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -332,18 +215,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided - fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -352,18 +223,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableContinueButtonAnimationIsServerProvided - fun provideFlagEnableContinueButtonAnimationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableSpotlightUi fun enableSpotlightUi(): PlatformParameterValue { @@ -372,18 +231,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableSpotlightUiIsServerProvided - fun provideFlagEnableSpotlightUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -392,18 +239,6 @@ class PlatformParameterAlphaKenyaModule { ) } - @Provides - @FlagEnableAppAndOsDeprecationIsServerProvided - fun provideFlagEnableAppAndOsDeprecationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( 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 0781615bdee..8addae7b9fd 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 @@ -30,40 +30,7 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE -import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS @@ -105,18 +72,6 @@ class PlatformParameterAlphaModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) - @Provides - @FlagEnableDownloadsSupportIsServerProvided - fun provideFlagEnableDownloadsSupportIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -146,18 +101,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableLanguageSelectionUiIsServerProvided - fun provideFlagEnableLanguageSelectionUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -175,18 +118,6 @@ class PlatformParameterAlphaModule { ?: PlatformParameterValue.createDefaultParameter(true) } - @Provides - @FlagEnableLearnerStudyAnalyticsIsServerProvided - fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -198,18 +129,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableFastLanguageSwitchingInLessonIsServerProvided - fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -219,18 +138,6 @@ class PlatformParameterAlphaModule { ?: PlatformParameterValue.createDefaultParameter(LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE) } - @Provides - @FlagEnableLoggingLearnerStudyIdsIsServerProvided - fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -252,18 +159,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnablePerformanceMetricsCollectionIsServerProvided - fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -305,18 +200,6 @@ class PlatformParameterAlphaModule { fun provideEnableSpotlightUi(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(true) // Enable spotlights for alpha users. - @Provides - @FlagEnableSpotlightUiIsServerProvided - fun provideFlagEnableSpotlightUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableExtraTopicTabsUi fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { @@ -325,18 +208,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableExtraTopicTabsUiIsServerProvided - fun provideFlagEnableExtraTopicTabsUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -345,18 +216,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided - fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -365,18 +224,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableContinueButtonAnimationIsServerProvided - fun provideFlagEnableContinueButtonAnimationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -385,18 +232,6 @@ class PlatformParameterAlphaModule { ) } - @Provides - @FlagEnableAppAndOsDeprecationIsServerProvided - fun provideFlagEnableAppAndOsDeprecationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( 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 b7c83c3734c..c2a211472fc 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 @@ -31,40 +31,7 @@ import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollecti import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED -import org.oppia.android.util.platformparameter.FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE -import org.oppia.android.util.platformparameter.FlagEnableAppAndOsDeprecationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableContinueButtonAnimationIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableDownloadsSupportIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableExtraTopicTabsUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableFastLanguageSwitchingInLessonIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableInteractionConfigChangeStateRetentionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLanguageSelectionUiIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLearnerStudyAnalyticsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableLoggingLearnerStudyIdsIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnablePerformanceMetricsCollectionIsServerProvided -import org.oppia.android.util.platformparameter.FlagEnableSpotlightUiIsServerProvided import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE @@ -107,18 +74,6 @@ class PlatformParameterModule { fun provideEnableDownloadsSupport(): PlatformParameterValue = PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) - @Provides - @FlagEnableDownloadsSupportIsServerProvided - fun provideFlagEnableDownloadsSupportIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( @@ -148,18 +103,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableLanguageSelectionUiIsServerProvided - fun provideFlagEnableLanguageSelectionUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableEditAccountsOptionsUi fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { @@ -177,18 +120,6 @@ class PlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE) } - @Provides - @FlagEnableLearnerStudyAnalyticsIsServerProvided - fun provideFlagEnableLearnerStudyAnalyticsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableFastLanguageSwitchingInLesson fun provideFastInLessonLanguageSwitching( @@ -200,18 +131,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableFastLanguageSwitchingInLessonIsServerProvided - fun provideFlagEnableFastLanguageSwitchingInLessonIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableLoggingLearnerStudyIds fun provideLoggingLearnerStudyIds( @@ -221,18 +140,6 @@ class PlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE) } - @Provides - @FlagEnableLoggingLearnerStudyIdsIsServerProvided - fun provideFlagEnableLoggingLearnerStudyIdsIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @CacheLatexRendering fun provideCacheLatexRendering( @@ -254,18 +161,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnablePerformanceMetricsCollectionIsServerProvided - fun provideFlagEnablePerformanceMetricsCollectionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @PerformanceMetricsCollectionUploadTimeIntervalInMinutes fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( @@ -310,18 +205,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableSpotlightUiIsServerProvided - fun provideFlagEnableSpotlightUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableExtraTopicTabsUi fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { @@ -330,18 +213,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableExtraTopicTabsUiIsServerProvided - fun provideFlagEnableExtraTopicTabsUiIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableInteractionConfigChangeStateRetention fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { @@ -350,18 +221,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableInteractionConfigChangeStateRetentionIsServerProvided - fun provideFlagEnableInteractionConfigChangeStateRetentionIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableContinueButtonAnimation fun provideEnableContinueButtonAnimation(): PlatformParameterValue { @@ -370,18 +229,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableContinueButtonAnimationIsServerProvided - fun provideFlagEnableContinueButtonAnimationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @EnableAppAndOsDeprecation fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { @@ -390,18 +237,6 @@ class PlatformParameterModule { ) } - @Provides - @FlagEnableAppAndOsDeprecationIsServerProvided - fun provideFlagEnableAppAndOsDeprecationIsServerProvided( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @OptionalAppUpdateVersionCode fun provideOptionalAppUpdateVersionCode( diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt index b672ad6cdf9..9d00ea77ed2 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt @@ -26,6 +26,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi return object : PlatformParameterValue { override val value: String get() = parameter.string + override val isSynced: Boolean + get() = parameter.isSynced } } @@ -38,6 +40,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi return object : PlatformParameterValue { override val value: Int get() = parameter.integer + override val isSynced: Boolean + get() = parameter.isSynced } } @@ -50,6 +54,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi return object : PlatformParameterValue { override val value: Boolean get() = parameter.boolean + override val isSynced: Boolean + get() = parameter.isSynced } } } diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index 645012e1f79..5232d8eedba 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -81,7 +81,7 @@ class PlatformParameterSyncUpWorker private constructor( */ private fun parseNetworkResponse(response: Map): List { return response.map { - val platformParameter = PlatformParameter.newBuilder().setName(it.key) + val platformParameter = PlatformParameter.newBuilder().setName(it.key).setIsSynced(true) when (val value = it.value) { is String -> platformParameter.string = value is Int -> platformParameter.integer = value @@ -112,12 +112,11 @@ class PlatformParameterSyncUpWorker private constructor( val responseBody = checkNotNull(response.body()) val platformParameterList = parseNetworkResponse(responseBody) - val platformParameterListWithSyncStatusFlags = platformParameterList.addSyncStatusFlags() - if (platformParameterListWithSyncStatusFlags.isEmpty()) { + if (platformParameterList.isEmpty()) { throw IllegalArgumentException(EMPTY_RESPONSE_EXCEPTION_MSG) } val cachingResult = platformParameterController - .updatePlatformParameterDatabase(platformParameterListWithSyncStatusFlags) + .updatePlatformParameterDatabase(platformParameterList) .retrieveData() if (cachingResult is AsyncResult.Failure) { throw IllegalStateException(cachingResult.error) @@ -134,24 +133,6 @@ class PlatformParameterSyncUpWorker private constructor( } } - private fun List.addSyncStatusFlags(): List { - val modifiedList = mutableListOf() - - for (param in this) { - modifiedList.add(param) - val syncStatusParamName = "flag_" + param.name + "_is_server_provided" - - val paramSyncStatusTracker = PlatformParameter.newBuilder().apply { - name = syncStatusParamName - boolean = true // Indicates that sync status flags are up to date since they are local only - } - .build() - modifiedList.add(paramSyncStatusTracker) - } - - return modifiedList - } - /** Creates an instance of [PlatformParameterSyncUpWorker] by properly injecting dependencies. */ class Factory @Inject constructor( private val platformParameterController: PlatformParameterController, diff --git a/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt index 1730f091d1b..3d9b4bf8408 100644 --- a/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt @@ -843,6 +843,7 @@ class AudioPlayerControllerTest { val enableFeature = enableLearnerStudyAnalytics return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = false } } @@ -854,6 +855,7 @@ class AudioPlayerControllerTest { val enableFeature = enableLearnerStudyAnalytics return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = false } } } diff --git a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt index aca0317b11e..6737bc6066f 100644 --- a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt @@ -43,7 +43,6 @@ import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.data.DataProviderTestMonitor import org.oppia.android.testing.network.MockPlatformParameterService import org.oppia.android.testing.network.RetrofitTestModule -import org.oppia.android.testing.platformparameter.FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED import org.oppia.android.testing.platformparameter.TEST_BOOLEAN_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_BOOLEAN_PARAM_SERVER_VALUE import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_DEFAULT_VALUE @@ -51,7 +50,6 @@ import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_INTEGER_PARAM_SERVER_VALUE import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_NAME import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SERVER_VALUE -import org.oppia.android.testing.platformparameter.TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -97,26 +95,25 @@ class PlatformParameterSyncUpWorkerTest { private val expectedTestStringParameter = PlatformParameter.newBuilder() .setName(TEST_STRING_PARAM_NAME) .setString(TEST_STRING_PARAM_SERVER_VALUE) + .setIsSynced(true) .build() private val expectedTestIntegerParameter = PlatformParameter.newBuilder() .setName(TEST_INTEGER_PARAM_NAME) .setInteger(TEST_INTEGER_PARAM_SERVER_VALUE) + .setIsSynced(true) .build() private val defaultTestIntegerParameter = PlatformParameter.newBuilder() .setName(TEST_INTEGER_PARAM_NAME) .setInteger(TEST_INTEGER_PARAM_DEFAULT_VALUE) + .setIsSynced(false) .build() private val expectedTestBooleanParameter = PlatformParameter.newBuilder() .setName(TEST_BOOLEAN_PARAM_NAME) .setBoolean(TEST_BOOLEAN_PARAM_SERVER_VALUE) - .build() - - private val expectedTestStringParameterFlagStatus = PlatformParameter.newBuilder() - .setName(FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED) - .setBoolean(TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE) + .setIsSynced(true) .build() // Not including "expectedTestBooleanParameter" in this list to prove that a refresh took place @@ -360,10 +357,56 @@ class PlatformParameterSyncUpWorkerTest { // Values retrieved from Cache store will be sent to Platform Parameter Singleton by the // Controller in the form of a Map, therefore verify the retrieved values from that Map. - val platformParameterMapFlagStatus = platformParameterSingleton.getPlatformParameterMap() - assertThat(platformParameterMapFlagStatus).containsEntry( - FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED, expectedTestStringParameterFlagStatus - ) + val platformParameterMap = platformParameterSingleton.getPlatformParameterMap() + + // Previous String Platform Parameter is still same in the Database. + assertThat(platformParameterMap) + .containsEntry(TEST_STRING_PARAM_NAME, expectedTestStringParameter) + + // Is synced boolean of the platform parameter is true + assertThat(platformParameterMap[TEST_STRING_PARAM_NAME]!!.isSynced).isEqualTo(true) + } + + @Test + fun testSyncUpWorker_databaseNotEmpty_getEmptyResponse_verifySyncStatusNotUpdated() { + // Set up versionName to get incorrect network response from mock platform parameter service. + setUpApplicationForContext(MockPlatformParameterService.appVersionForEmptyResponse) + + // Fill the Platform Parameter Database with mock values to simulate the execution of a SyncUp + // Work request that is not first. + platformParameterController.updatePlatformParameterDatabase(mockPlatformParameterList) + + val workManager = WorkManager.getInstance(context) + + val inputData = Data.Builder().putString( + PlatformParameterSyncUpWorker.WORKER_TYPE_KEY, + PlatformParameterSyncUpWorker.PLATFORM_PARAMETER_WORKER + ).build() + + val request: OneTimeWorkRequest = OneTimeWorkRequestBuilder() + .setInputData(inputData) + .build() + + // Enqueue the Work Request to fetch and cache the Platform Parameters from Remote Service. + workManager.enqueue(request) + testCoroutineDispatchers.runCurrent() + + val workInfo = workManager.getWorkInfoById(request.id) + assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) + + val exceptionMessage = fakeExceptionLogger.getMostRecentException().message + assertThat(exceptionMessage) + .isEqualTo(PlatformParameterSyncUpWorker.EMPTY_RESPONSE_EXCEPTION_MSG) + + // Retrieve the previously cached Platform Parameters from Cache Store. + monitorFactory.ensureDataProviderExecutes(platformParameterController.getParameterDatabase()) + + // Values retrieved from Cache store will be sent to Platform Parameter Singleton by the + // Controller in the form of a Map, therefore verify the retrieved values from that Map. + val platformParameterMap = platformParameterSingleton.getPlatformParameterMap() + + // Previous integer sync status is still the same in the database + assertThat(platformParameterMap[TEST_INTEGER_PARAM_NAME]!!.isSynced).isEqualTo(false) } private fun setUpTestApplicationComponent() { diff --git a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt index 62733f8119c..71b1798f1b1 100644 --- a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt @@ -1358,6 +1358,7 @@ class ProfileManagementControllerTest { val enableFeature = enableLearnerStudyAnalytics return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = true } } @@ -1369,6 +1370,7 @@ class ProfileManagementControllerTest { val enableFeature = enableLearnerStudyAnalytics return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = true } } } diff --git a/model/src/main/proto/platform_parameter.proto b/model/src/main/proto/platform_parameter.proto index 67f9fd6d772..b42ea11d909 100644 --- a/model/src/main/proto/platform_parameter.proto +++ b/model/src/main/proto/platform_parameter.proto @@ -18,6 +18,8 @@ message PlatformParameter { // Indicates a string-typed platform parameter. string string = 4; } + // Indicates that the platform parameter is synced + bool is_synced = 5; } // Format of platform parameters stored on disk. It closely resembles the JSON response in cache. diff --git a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt index 567184a9bdd..a904314f795 100644 --- a/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt +++ b/testing/src/main/java/org/oppia/android/testing/platformparameter/TestPlatformParameterConstants.kt @@ -25,25 +25,6 @@ const val TEST_STRING_PARAM_DEFAULT_VALUE = "test_string_param_default_value" */ const val TEST_STRING_PARAM_SERVER_VALUE = "test_string_param_value" -/** - * Feature flag sync status name for the test string platform parameter. This name helps retrieve - * the sync status of the [TestStringParam]. Only used in tests related to platform parameter. - */ -const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED = - "flag_test_string_param_name_is_server_provided" - -/** - * Default value for the feature flag sync status tracker for the [TestStringParam]. Only used in - * tests related to platform parameter. - */ -const val FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - -/** - * Server value for the test string platform parameter. Only used in tests related to platform - * parameter. - */ -const val TEST_STRING_PARAM_SYNC_STATUS_FLAG_SERVER_VALUE = true - /** * Qualifier for test boolean platform parameter. Only used in tests related to platform parameter. */ 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 2e0d35203e1..7ff02772a65 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 @@ -99,18 +99,6 @@ class TestPlatformParameterModule { ?: PlatformParameterValue.createDefaultParameter(TEST_BOOLEAN_PARAM_DEFAULT_VALUE) } - @Provides - @Singleton - fun provideFlagTestStringParam( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED - ) ?: PlatformParameterValue.createDefaultParameter( - FLAG_TEST_STRING_PARAM_IS_SERVER_PROVIDED_DEFAULT_VALUE - ) - } - @Provides @SplashScreenWelcomeMsg fun provideSplashScreenWelcomeMsgParam( 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 b7045b20772..a785a61d836 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 @@ -21,23 +21,6 @@ import javax.inject.Qualifier /** Default value for feature flag corresponding to [EnableDownloadsSupport]. */ const val ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableDownloadsSupport] and help determine - * if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableDownloadsSupportIsServerProvided - -/** The feature flag name corresponding to [FlagEnableDownloadsSupportIsServerProvided]. */ -const val FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED = - "flag_enable_downloads_support_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableDownloadsSupportIsServerProvided]. - */ -const val FLAG_ENABLE_DOWNLOADS_SUPPORT_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** Qualifier for the feature flag corresponding to enabling the language selection UI. */ @Qualifier annotation class EnableLanguageSelectionUi @@ -45,23 +28,6 @@ annotation class EnableLanguageSelectionUi /** Default value for the feature flag corresponding to [EnableLanguageSelectionUi]. */ const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = true -/** - * Qualifier to keep track of the sync status of the [EnableLanguageSelectionUi] and help determine - * if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableLanguageSelectionUiIsServerProvided - -/** The feature flag name corresponding to [FlagEnableLanguageSelectionUiIsServerProvided]. */ -const val FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED = - "flag_enable_language_selection_ui_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableLanguageSelectionUiIsServerProvided]. - */ -const val FLAG_ENABLE_LANGUAGE_SELECTION_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for the feature flag corresponding to enabling the extra topic tabs: practice and info. */ @@ -71,23 +37,6 @@ annotation class EnableExtraTopicTabsUi /** Default value for the feature flag corresponding to [EnableExtraTopicTabsUi]. */ const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableExtraTopicTabsUi] and help determine - * if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableExtraTopicTabsUiIsServerProvided - -/** The feature flag name corresponding to [FlagEnableExtraTopicTabsUiIsServerProvided]. */ -const val FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED = - "flag_enable_extra_topic_tabs_ui_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableExtraTopicTabsUiIsServerProvided]. - */ -const val FLAG_ENABLE_EXTRA_TOPIC_TABS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for the feature flag that controls the visibility of [ProfileAndDeviceIdActivity] * and working of learner study related analytics logging. @@ -107,23 +56,6 @@ const val LEARNER_STUDY_ANALYTICS = "learner_study_analytics" */ const val LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableLearnerStudyAnalytics] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableLearnerStudyAnalyticsIsServerProvided - -/** The feature flag name corresponding to [FlagEnableLearnerStudyAnalyticsIsServerProvided]. */ -const val FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED = - "flag_enable_learner_study_analytics_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableLearnerStudyAnalyticsIsServerProvided]. - */ -const val FLAG_ENABLE_LEARNER_STUDY_ANALYTICS_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for a feature flag that controls whether learners may be allowed (via an * admin-controlled setting) to use a special in-lesson button for quickly switching between content @@ -141,26 +73,6 @@ const val FAST_LANGUAGE_SWITCHING_IN_LESSON = "fast_language_switching_in_lesson */ const val FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableFastLanguageSwitchingInLesson] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableFastLanguageSwitchingInLessonIsServerProvided - -/** - * The feature flag name corresponding to - * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. - */ -const val FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED = - "flag_enable_fast_language_switching_in_lesson_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableFastLanguageSwitchingInLessonIsServerProvided]. - */ -const val FLAG_ENABLE_FAST_LANGUAGE_SWITCHING_IN_LESSON_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for a feature flag that controls whether learner study IDs should be generated and * logged with outgoing events. @@ -175,23 +87,6 @@ const val LOGGING_LEARNER_STUDY_IDS = "logging_learner_study_ids" /** The default enabled state for the feature corresponding to [EnableLoggingLearnerStudyIds]. */ const val LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableLoggingLearnerStudyIds] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableLoggingLearnerStudyIdsIsServerProvided - -/** The feature flag name corresponding to [FlagEnableLoggingLearnerStudyIdsIsServerProvided]. */ -const val FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED = - "flag_enable_logging_learner_study_ids_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableLoggingLearnerStudyIdsIsServerProvided]. - */ -const val FLAG_ENABLE_LOGGING_LEARNER_STUDY_IDS_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** Qualifier for the feature flag corresponding to enabling the edit accounts options. */ @Qualifier annotation class EnableEditAccountsOptionsUi @@ -199,23 +94,6 @@ annotation class EnableEditAccountsOptionsUi /** Default value for the feature flag corresponding to [EnableEditAccountsOptionsUi]. */ const val ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableEditAccountsOptionsUi] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableEditAccountsOptionsUiIsServerProvided - -/** The feature flag name corresponding to [FlagEnableEditAccountsOptionsUiIsServerProvided]. */ -const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED = - "flag_enable_edit_accounts_options_ui_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableEditAccountsOptionsUiIsServerProvided]. - */ -const val FLAG_ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** Qualifier for the feature flag that controls whether to record performance metrics. */ @Qualifier annotation class EnablePerformanceMetricsCollection @@ -226,25 +104,6 @@ const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_co /** Default value for whether to record performance metrics. */ const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnablePerformanceMetricsCollection] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnablePerformanceMetricsCollectionIsServerProvided - -/** - * The feature flag name corresponding to [FlagEnablePerformanceMetricsCollectionIsServerProvided]. - */ -const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED = - "flag_enable_performance_metrics_collection_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnablePerformanceMetricsCollectionIsServerProvided]. - */ -const val FLAG_ENABLE_PERFORMANCE_METRICS_COLLECTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for the feature flag that controls whether to animate the continue button * interaction and navigation items. This is used to disable the animation during testing because @@ -256,23 +115,6 @@ annotation class EnableContinueButtonAnimation /** Default value for whether to enable continue button animation. */ const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true -/** - * Qualifier to keep track of the sync status of the [EnableContinueButtonAnimation] and help - * determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableContinueButtonAnimationIsServerProvided - -/** The feature flag name corresponding to [FlagEnableContinueButtonAnimationIsServerProvided]. */ -const val FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED = - "flag_enable_continue_button_animation_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableContinueButtonAnimationIsServerProvided]. - */ -const val FLAG_ENABLE_CONTINUE_BUTTON_ANIMATION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** Qualifier for the feature flag corresponding to enabling the spotlight UI. */ @Qualifier annotation class EnableSpotlightUi @@ -280,23 +122,6 @@ annotation class EnableSpotlightUi /** Default value for the feature flag corresponding to [EnableSpotlightUi]. */ const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableSpotlightUi] and help determine - * if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableSpotlightUiIsServerProvided - -/** The feature flag name corresponding to [FlagEnableSpotlightUiIsServerProvided]. */ -const val FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED = - "flag_enable_spotlight_ui_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableSpotlightUiIsServerProvided]. - */ -const val FLAG_ENABLE_SPOTLIGHT_UI_IS_SERVER_PROVIDED_DEFAULT_VALUE = false - /** * Qualifier for the feature flag that controls whether input interaction state is correctly * retained across configuration changes. @@ -309,27 +134,6 @@ annotation class EnableInteractionConfigChangeStateRetention */ const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false -/** - * Qualifier to keep track of the sync status of the [EnableInteractionConfigChangeStateRetention] - * and help determine if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableInteractionConfigChangeStateRetentionIsServerProvided - -/** - * The feature flag name corresponding to - * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. - */ -const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED = - "flag_enable_interaction_config_change_state_retention_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableInteractionConfigChangeStateRetentionIsServerProvided]. - */ -const val FLAG_ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_IS_SERVER_PROVIDED_DEFAULT_VALUE = - false - /** * Qualifier for the [EnableAppAndOsDeprecation] feature flag that controls whether to enable * app and OS deprecation or not. @@ -341,20 +145,3 @@ annotation class EnableAppAndOsDeprecation * Default value for the feature flag corresponding to [EnableAppAndOsDeprecation]. */ const val ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE = false - -/** - * Qualifier to keep track of the sync status of the [EnableAppAndOsDeprecation] and help determine - * if the value of the feature flag is server-provided or default. - */ -@Qualifier -annotation class FlagEnableAppAndOsDeprecationIsServerProvided - -/** The feature flag name corresponding to [FlagEnableAppAndOsDeprecationIsServerProvided]. */ -const val FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED = - "flag_enable_app_and_os_deprecation_is_server_provided" - -/** - * Default value for the feature flag sync status tracker corresponding to - * [FlagEnableAppAndOsDeprecationIsServerProvided]. - */ -const val FLAG_ENABLE_APP_AND_OS_DEPRECATION_IS_SERVER_PROVIDED_DEFAULT_VALUE = false diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt index 309574d9660..b2e3dafc6ab 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt @@ -9,16 +9,23 @@ import org.oppia.android.app.model.PlatformParameter */ interface PlatformParameterValue { val value: T + val isSynced: Boolean companion object { /** * Creates a Platform Parameter Implementation containing the default value for a particular * Platform Parameter */ - fun createDefaultParameter(defaultValue: T): PlatformParameterValue { + fun createDefaultParameter( + defaultValue: T, + defaultIsSynced: Boolean = false + ): PlatformParameterValue { return object : PlatformParameterValue { override val value: T get() = defaultValue + + override val isSynced: Boolean + get() = defaultIsSynced } } } From 7ee1fd817e0e415e93297a63c0e6d6575fecf195 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Tue, 7 Nov 2023 13:33:41 +0300 Subject: [PATCH 14/20] fix: Fix failing EventBundleCreator tests --- .../org/oppia/android/util/logging/EventBundleCreatorTest.kt | 1 + .../android/util/logging/KenyaAlphaEventBundleCreatorTest.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt index d2062e9097f..10bcfe91263 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt @@ -2416,6 +2416,7 @@ class EventBundleCreatorTest { val enableFeature = enableLoggingLearnerStudyIds return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = false } } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt index 562f16b4337..1d50bc1b42d 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt @@ -1583,6 +1583,7 @@ class KenyaAlphaEventBundleCreatorTest { val enableFeature = enableLoggingLearnerStudyIds return object : PlatformParameterValue { override val value: Boolean = enableFeature + override val isSynced: Boolean = false } } } From b9f28bad5c4247d8194a003988a1264dc13ee096 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Tue, 14 Nov 2023 12:46:26 +0300 Subject: [PATCH 15/20] feat: Make Sync status an enum --- .../analytics/ApplicationLifecycleObserver.kt | 1 + .../PlatformParameterSingletonImpl.kt | 18 ++++------ .../syncup/PlatformParameterSyncUpWorker.kt | 4 ++- .../domain/audio/AudioPlayerControllerTest.kt | 14 ++++---- .../PlatformParameterSyncUpWorkerTest.kt | 33 +++++++++---------- .../ProfileManagementControllerTest.kt | 14 ++++---- model/src/main/proto/platform_parameter.proto | 15 +++++++-- .../PlatformParameterValue.kt | 12 +++---- .../util/logging/EventBundleCreatorTest.kt | 7 ++-- .../KenyaAlphaEventBundleCreatorTest.kt | 7 ++-- 10 files changed, 61 insertions(+), 64 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt index 8a4504b4372..2d62cdcd639 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt @@ -1,3 +1,4 @@ + package org.oppia.android.domain.oppialogger.analytics import android.app.Activity diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt index 9d00ea77ed2..0a72d4b6b44 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterSingletonImpl.kt @@ -24,10 +24,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi val parameter = platformParameterMap[platformParameterName] ?: return null if (!parameter.valueTypeCase.equals(PlatformParameter.ValueTypeCase.STRING)) return null return object : PlatformParameterValue { - override val value: String - get() = parameter.string - override val isSynced: Boolean - get() = parameter.isSynced + override val value = parameter.string + override val syncStatus = parameter.syncStatus } } @@ -38,10 +36,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi val parameter = platformParameterMap[platformParameterName] ?: return null if (!parameter.valueTypeCase.equals(PlatformParameter.ValueTypeCase.INTEGER)) return null return object : PlatformParameterValue { - override val value: Int - get() = parameter.integer - override val isSynced: Boolean - get() = parameter.isSynced + override val value = parameter.integer + override val syncStatus = parameter.syncStatus } } @@ -52,10 +48,8 @@ class PlatformParameterSingletonImpl @Inject constructor() : PlatformParameterSi val parameter = platformParameterMap[platformParameterName] ?: return null if (!parameter.valueTypeCase.equals(PlatformParameter.ValueTypeCase.BOOLEAN)) return null return object : PlatformParameterValue { - override val value: Boolean - get() = parameter.boolean - override val isSynced: Boolean - get() = parameter.isSynced + override val value = parameter.boolean + override val syncStatus = parameter.syncStatus } } } diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt index 5232d8eedba..164f7fea914 100644 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt +++ b/domain/src/main/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorker.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import org.oppia.android.app.model.PlatformParameter +import org.oppia.android.app.model.PlatformParameter.SyncStatus import org.oppia.android.app.utility.getVersionName import org.oppia.android.data.backends.gae.api.PlatformParameterService import org.oppia.android.domain.oppialogger.OppiaLogger @@ -81,7 +82,8 @@ class PlatformParameterSyncUpWorker private constructor( */ private fun parseNetworkResponse(response: Map): List { return response.map { - val platformParameter = PlatformParameter.newBuilder().setName(it.key).setIsSynced(true) + val platformParameter = PlatformParameter.newBuilder().setName(it.key) + .setSyncStatus(SyncStatus.SYNCED_FROM_SERVER) when (val value = it.value) { is String -> platformParameter.string = value is Int -> platformParameter.integer = value diff --git a/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt index 3d9b4bf8408..1854ec26330 100644 --- a/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/audio/AudioPlayerControllerTest.kt @@ -841,10 +841,9 @@ class AudioPlayerControllerTest { fun provideLearnerStudyAnalytics(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLearnerStudyAnalytics - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = false - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } @Provides @@ -853,10 +852,9 @@ class AudioPlayerControllerTest { fun provideLoggingLearnerStudyIds(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLearnerStudyAnalytics - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = false - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } } diff --git a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt index 6737bc6066f..82e756c79e6 100644 --- a/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/platformparameter/syncup/PlatformParameterSyncUpWorkerTest.kt @@ -25,6 +25,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.oppia.android.app.model.PlatformParameter +import org.oppia.android.app.model.PlatformParameter.SyncStatus import org.oppia.android.data.backends.gae.BaseUrl import org.oppia.android.data.backends.gae.JsonPrefixNetworkInterceptor import org.oppia.android.data.backends.gae.NetworkApiKey @@ -95,25 +96,25 @@ class PlatformParameterSyncUpWorkerTest { private val expectedTestStringParameter = PlatformParameter.newBuilder() .setName(TEST_STRING_PARAM_NAME) .setString(TEST_STRING_PARAM_SERVER_VALUE) - .setIsSynced(true) + .setSyncStatus(SyncStatus.SYNCED_FROM_SERVER) .build() private val expectedTestIntegerParameter = PlatformParameter.newBuilder() .setName(TEST_INTEGER_PARAM_NAME) .setInteger(TEST_INTEGER_PARAM_SERVER_VALUE) - .setIsSynced(true) + .setSyncStatus(SyncStatus.SYNCED_FROM_SERVER) .build() private val defaultTestIntegerParameter = PlatformParameter.newBuilder() .setName(TEST_INTEGER_PARAM_NAME) .setInteger(TEST_INTEGER_PARAM_DEFAULT_VALUE) - .setIsSynced(false) + .setSyncStatus(SyncStatus.NOT_SYNCED_FROM_SERVER) .build() private val expectedTestBooleanParameter = PlatformParameter.newBuilder() .setName(TEST_BOOLEAN_PARAM_NAME) .setBoolean(TEST_BOOLEAN_PARAM_SERVER_VALUE) - .setIsSynced(true) + .setSyncStatus(SyncStatus.SYNCED_FROM_SERVER) .build() // Not including "expectedTestBooleanParameter" in this list to prove that a refresh took place @@ -349,9 +350,6 @@ class PlatformParameterSyncUpWorkerTest { workManager.enqueue(request) testCoroutineDispatchers.runCurrent() - val workInfo = workManager.getWorkInfoById(request.id) - assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.SUCCEEDED) - // Retrieve the previously cached Platform Parameters from Cache Store. monitorFactory.ensureDataProviderExecutes(platformParameterController.getParameterDatabase()) @@ -363,8 +361,9 @@ class PlatformParameterSyncUpWorkerTest { assertThat(platformParameterMap) .containsEntry(TEST_STRING_PARAM_NAME, expectedTestStringParameter) - // Is synced boolean of the platform parameter is true - assertThat(platformParameterMap[TEST_STRING_PARAM_NAME]!!.isSynced).isEqualTo(true) + // SyncStatus of the platform parameter is SYNCED_FROM_SERVER + assertThat(platformParameterMap[TEST_STRING_PARAM_NAME]?.syncStatus) + .isEqualTo(SyncStatus.SYNCED_FROM_SERVER) } @Test @@ -391,13 +390,6 @@ class PlatformParameterSyncUpWorkerTest { workManager.enqueue(request) testCoroutineDispatchers.runCurrent() - val workInfo = workManager.getWorkInfoById(request.id) - assertThat(workInfo.get().state).isEqualTo(WorkInfo.State.FAILED) - - val exceptionMessage = fakeExceptionLogger.getMostRecentException().message - assertThat(exceptionMessage) - .isEqualTo(PlatformParameterSyncUpWorker.EMPTY_RESPONSE_EXCEPTION_MSG) - // Retrieve the previously cached Platform Parameters from Cache Store. monitorFactory.ensureDataProviderExecutes(platformParameterController.getParameterDatabase()) @@ -405,8 +397,13 @@ class PlatformParameterSyncUpWorkerTest { // Controller in the form of a Map, therefore verify the retrieved values from that Map. val platformParameterMap = platformParameterSingleton.getPlatformParameterMap() - // Previous integer sync status is still the same in the database - assertThat(platformParameterMap[TEST_INTEGER_PARAM_NAME]!!.isSynced).isEqualTo(false) + // Previous Integer Platform Parameter is still same in the Database. + assertThat(platformParameterMap) + .containsEntry(TEST_INTEGER_PARAM_NAME, defaultTestIntegerParameter) + + // SyncStatus of the platform parameter is still the same in the database + assertThat(platformParameterMap[TEST_INTEGER_PARAM_NAME]?.syncStatus) + .isEqualTo(SyncStatus.NOT_SYNCED_FROM_SERVER) } private fun setUpTestApplicationComponent() { diff --git a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt index 71b1798f1b1..e95142771be 100644 --- a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt @@ -1356,10 +1356,9 @@ class ProfileManagementControllerTest { fun provideLearnerStudyAnalytics(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLearnerStudyAnalytics - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = true - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } @Provides @@ -1368,10 +1367,9 @@ class ProfileManagementControllerTest { fun provideLoggingLearnerStudyIds(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLearnerStudyAnalytics - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = true - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } } diff --git a/model/src/main/proto/platform_parameter.proto b/model/src/main/proto/platform_parameter.proto index b42ea11d909..58e45f8325c 100644 --- a/model/src/main/proto/platform_parameter.proto +++ b/model/src/main/proto/platform_parameter.proto @@ -18,8 +18,19 @@ message PlatformParameter { // Indicates a string-typed platform parameter. string string = 4; } - // Indicates that the platform parameter is synced - bool is_synced = 5; + // Indicates the sync status of the platform parameter. + SyncStatus sync_status = 5; + + enum SyncStatus { + // Indicates that the sync status isn't yet known. + SYNC_STATUS_UNSPECIFIED = 0; + + // Indicates that the parameter isn't yet synced with the remote server. + NOT_SYNCED_FROM_SERVER = 1; + + // Indicates the parameter's value has been synced with the remote server. + SYNCED_FROM_SERVER = 2; + } } // Format of platform parameters stored on disk. It closely resembles the JSON response in cache. diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt index b2e3dafc6ab..51523f0134f 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt @@ -1,6 +1,7 @@ package org.oppia.android.util.platformparameter import org.oppia.android.app.model.PlatformParameter +import org.oppia.android.app.model.PlatformParameter.SyncStatus /** * Generic interface that is used to provide platform parameter values corresponding to the @@ -9,7 +10,7 @@ import org.oppia.android.app.model.PlatformParameter */ interface PlatformParameterValue { val value: T - val isSynced: Boolean + val syncStatus: SyncStatus companion object { /** @@ -18,14 +19,11 @@ interface PlatformParameterValue { */ fun createDefaultParameter( defaultValue: T, - defaultIsSynced: Boolean = false + defaultIsSynced: SyncStatus = SyncStatus.NOT_SYNCED_FROM_SERVER ): PlatformParameterValue { return object : PlatformParameterValue { - override val value: T - get() = defaultValue - - override val isSynced: Boolean - get() = defaultIsSynced + override val value = defaultValue + override val syncStatus = defaultIsSynced } } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt index 10bcfe91263..db424118e1f 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt @@ -2414,10 +2414,9 @@ class EventBundleCreatorTest { fun provideLoggingLearnerStudyIds(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLoggingLearnerStudyIds - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = false - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt index 1d50bc1b42d..3ec4c2f5169 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt @@ -1581,10 +1581,9 @@ class KenyaAlphaEventBundleCreatorTest { fun provideLoggingLearnerStudyIds(): PlatformParameterValue { // Snapshot the value so that it doesn't change between injection and use. val enableFeature = enableLoggingLearnerStudyIds - return object : PlatformParameterValue { - override val value: Boolean = enableFeature - override val isSynced: Boolean = false - } + return PlatformParameterValue.createDefaultParameter( + defaultValue = enableFeature + ) } } From 501ae406a9ef1d97fe1d75d86a83a8bec502592c Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Tue, 14 Nov 2023 23:16:35 +0300 Subject: [PATCH 16/20] feat: Add feature flag names to all flags lacking one --- .../PlatformParameterAlphaKenyaModule.kt | 55 +++++++++++++----- .../PlatformParameterAlphaModule.kt | 57 +++++++++++++----- .../PlatformParameterModule.kt | 58 ++++++++++++++----- .../platformparameter/FeatureFlagConstants.kt | 20 +++++++ 4 files changed, 146 insertions(+), 44 deletions(-) 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 1b3293d56f5..d427ff5117f 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 @@ -4,9 +4,12 @@ import android.content.Context import dagger.Module import dagger.Provides import org.oppia.android.app.utility.getVersionCode +import org.oppia.android.util.platformparameter.APP_AND_OS_DEPRECATION import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering +import org.oppia.android.util.platformparameter.DOWNLOADS_SUPPORT +import org.oppia.android.util.platformparameter.EDIT_ACCOUNTS_OPTIONS_UI import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE @@ -17,6 +20,7 @@ import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEF 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 +import org.oppia.android.util.platformparameter.EXTRA_TOPIC_TABS_UI import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation import org.oppia.android.util.platformparameter.EnableDownloadsSupport @@ -32,6 +36,7 @@ import org.oppia.android.util.platformparameter.EnableSpotlightUi import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode +import org.oppia.android.util.platformparameter.INTERACTION_CONFIG_CHANGE_STATE_RETENTION import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS import org.oppia.android.util.platformparameter.LOWEST_SUPPORTED_API_LEVEL @@ -58,6 +63,7 @@ import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.SPOTLIGHT_UI import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg @@ -72,8 +78,12 @@ import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours class PlatformParameterAlphaKenyaModule { @Provides @EnableDownloadsSupport - fun provideEnableDownloadsSupport(): PlatformParameterValue = - PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + fun provideEnableDownloadsSupport( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(DOWNLOADS_SUPPORT) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + } @Provides @SplashScreenWelcomeMsg @@ -106,8 +116,12 @@ class PlatformParameterAlphaKenyaModule { @Provides @EnableEditAccountsOptionsUi - fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableEditAccountsOptionsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EDIT_ACCOUNTS_OPTIONS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE ) } @@ -201,16 +215,24 @@ class PlatformParameterAlphaKenyaModule { @Provides @EnableExtraTopicTabsUi - fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableExtraTopicTabsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EXTRA_TOPIC_TABS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE ) } @Provides @EnableInteractionConfigChangeStateRetention - fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableInteractionConfigChangeStateRetention( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + INTERACTION_CONFIG_CHANGE_STATE_RETENTION + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE ) } @@ -225,16 +247,21 @@ class PlatformParameterAlphaKenyaModule { @Provides @EnableSpotlightUi - fun enableSpotlightUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE - ) + fun provideEnableSpotlightUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(SPOTLIGHT_UI) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE) } @Provides @EnableAppAndOsDeprecation - fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableAppAndOsDeprecation( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + APP_AND_OS_DEPRECATION + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_APP_AND_OS_DEPRECATION_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 8addae7b9fd..7aec58bc1c6 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 @@ -4,9 +4,12 @@ import android.content.Context import dagger.Module import dagger.Provides import org.oppia.android.app.utility.getVersionCode +import org.oppia.android.util.platformparameter.APP_AND_OS_DEPRECATION import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering +import org.oppia.android.util.platformparameter.DOWNLOADS_SUPPORT +import org.oppia.android.util.platformparameter.EDIT_ACCOUNTS_OPTIONS_UI import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE @@ -16,6 +19,7 @@ import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_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 import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation import org.oppia.android.util.platformparameter.EnableDownloadsSupport @@ -32,6 +36,7 @@ import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSO import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode +import org.oppia.android.util.platformparameter.INTERACTION_CONFIG_CHANGE_STATE_RETENTION import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE @@ -59,6 +64,7 @@ import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.SPOTLIGHT_UI import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg @@ -69,8 +75,12 @@ import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours class PlatformParameterAlphaModule { @Provides @EnableDownloadsSupport - fun provideEnableDownloadsSupport(): PlatformParameterValue = - PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + fun provideEnableDownloadsSupport( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(DOWNLOADS_SUPPORT) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + } @Provides @SplashScreenWelcomeMsg @@ -103,8 +113,12 @@ class PlatformParameterAlphaModule { @Provides @EnableEditAccountsOptionsUi - fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableEditAccountsOptionsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EDIT_ACCOUNTS_OPTIONS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE ) } @@ -197,21 +211,33 @@ class PlatformParameterAlphaModule { @Provides @EnableSpotlightUi - fun provideEnableSpotlightUi(): PlatformParameterValue = - PlatformParameterValue.createDefaultParameter(true) // Enable spotlights for alpha users. + fun provideEnableSpotlightUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(SPOTLIGHT_UI) + ?: PlatformParameterValue.createDefaultParameter(true) // Enable spotlights for alpha users. + } @Provides @EnableExtraTopicTabsUi - fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableExtraTopicTabsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EXTRA_TOPIC_TABS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE ) } @Provides @EnableInteractionConfigChangeStateRetention - fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableInteractionConfigChangeStateRetention( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + INTERACTION_CONFIG_CHANGE_STATE_RETENTION + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE ) } @@ -226,10 +252,13 @@ class PlatformParameterAlphaModule { @Provides @EnableAppAndOsDeprecation - fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE - ) + fun provideEnableAppAndOsDeprecation( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(APP_AND_OS_DEPRECATION) + ?: PlatformParameterValue.createDefaultParameter( + ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE + ) } @Provides 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 c2a211472fc..33318858a69 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 @@ -4,9 +4,12 @@ import android.content.Context import dagger.Module import dagger.Provides import org.oppia.android.app.utility.getVersionCode +import org.oppia.android.util.platformparameter.APP_AND_OS_DEPRECATION import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE import org.oppia.android.util.platformparameter.CacheLatexRendering +import org.oppia.android.util.platformparameter.DOWNLOADS_SUPPORT +import org.oppia.android.util.platformparameter.EDIT_ACCOUNTS_OPTIONS_UI import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE @@ -17,6 +20,7 @@ import org.oppia.android.util.platformparameter.ENABLE_LANGUAGE_SELECTION_UI_DEF 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 +import org.oppia.android.util.platformparameter.EXTRA_TOPIC_TABS_UI import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation import org.oppia.android.util.platformparameter.EnableContinueButtonAnimation import org.oppia.android.util.platformparameter.EnableDownloadsSupport @@ -33,6 +37,7 @@ import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSO import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON_DEFAULT_VALUE import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode +import org.oppia.android.util.platformparameter.INTERACTION_CONFIG_CHANGE_STATE_RETENTION import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS @@ -61,6 +66,7 @@ import org.oppia.android.util.platformparameter.PlatformParameterSingleton import org.oppia.android.util.platformparameter.PlatformParameterValue import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE +import org.oppia.android.util.platformparameter.SPOTLIGHT_UI import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg @@ -71,8 +77,12 @@ import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours class PlatformParameterModule { @Provides @EnableDownloadsSupport - fun provideEnableDownloadsSupport(): PlatformParameterValue = - PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + fun provideEnableDownloadsSupport( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(DOWNLOADS_SUPPORT) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) + } @Provides @SplashScreenWelcomeMsg @@ -105,8 +115,12 @@ class PlatformParameterModule { @Provides @EnableEditAccountsOptionsUi - fun provideEnableEditAccountsOptionsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableEditAccountsOptionsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EDIT_ACCOUNTS_OPTIONS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE ) } @@ -199,24 +213,33 @@ class PlatformParameterModule { @Provides @EnableSpotlightUi - fun provideEnableSpotlightUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE - ) + fun provideEnableSpotlightUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(SPOTLIGHT_UI) + ?: PlatformParameterValue.createDefaultParameter(ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE) } @Provides @EnableExtraTopicTabsUi - fun provideEnableExtraTopicTabsUi(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableExtraTopicTabsUi( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + EXTRA_TOPIC_TABS_UI + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE ) } @Provides @EnableInteractionConfigChangeStateRetention - fun provideEnableInteractionConfigChangeStateRetention(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( + fun provideEnableInteractionConfigChangeStateRetention( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter( + INTERACTION_CONFIG_CHANGE_STATE_RETENTION + ) ?: PlatformParameterValue.createDefaultParameter( ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE ) } @@ -231,10 +254,13 @@ class PlatformParameterModule { @Provides @EnableAppAndOsDeprecation - fun provideEnableAppAndOsDeprecation(): PlatformParameterValue { - return PlatformParameterValue.createDefaultParameter( - ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE - ) + fun provideEnableAppAndOsDeprecation( + platformParameterSingleton: PlatformParameterSingleton + ): PlatformParameterValue { + return platformParameterSingleton.getBooleanPlatformParameter(APP_AND_OS_DEPRECATION) + ?: PlatformParameterValue.createDefaultParameter( + ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE + ) } @Provides 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 a785a61d836..6d5d716d730 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 @@ -18,6 +18,9 @@ import javax.inject.Qualifier */ @Qualifier annotation class EnableDownloadsSupport +/** Name of the feature flag that controls whether to enable downloads support. */ +const val DOWNLOADS_SUPPORT = "downloads_support" + /** Default value for feature flag corresponding to [EnableDownloadsSupport]. */ const val ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE = false @@ -34,6 +37,9 @@ const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = true @Qualifier annotation class EnableExtraTopicTabsUi +/** Name of the feature flag that controls whether to enable the extra topics tab UI. */ +const val EXTRA_TOPIC_TABS_UI = "extra_topics_tab_ui" + /** Default value for the feature flag corresponding to [EnableExtraTopicTabsUi]. */ const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false @@ -91,6 +97,9 @@ const val LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE = false @Qualifier annotation class EnableEditAccountsOptionsUi +/** Name of the feature flag that controls whether to enable the edit account options UI. */ +const val EDIT_ACCOUNTS_OPTIONS_UI = "edit_accounts_options_ui" + /** Default value for the feature flag corresponding to [EnableEditAccountsOptionsUi]. */ const val ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE = false @@ -119,6 +128,9 @@ const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true @Qualifier annotation class EnableSpotlightUi +/** Name of the feature flag that controls whether to enable the spotlight UI. */ +const val SPOTLIGHT_UI = "spotlight_ui" + /** Default value for the feature flag corresponding to [EnableSpotlightUi]. */ const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false @@ -129,6 +141,11 @@ const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false @Qualifier annotation class EnableInteractionConfigChangeStateRetention +/** Name of the feature flag that controls whether input interaction state is correctly retained + * across configuration changes. + */ +const val INTERACTION_CONFIG_CHANGE_STATE_RETENTION = "interaction_config_change_state_retention" + /** * Default value for feature flag corresponding to [EnableInteractionConfigChangeStateRetention]. */ @@ -141,6 +158,9 @@ const val ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE = false @Qualifier annotation class EnableAppAndOsDeprecation +/** Name of the feature flag that controls whether to enable app and os deprecation. */ +const val APP_AND_OS_DEPRECATION = "app_and_os_deprecation" + /** * Default value for the feature flag corresponding to [EnableAppAndOsDeprecation]. */ From 551fd4a1e54acf0546df1ccd219ed532bb7c62e6 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 15 Nov 2023 15:22:32 +0300 Subject: [PATCH 17/20] fix: Fix failing check and linting issue --- .../oppialogger/analytics/ApplicationLifecycleObserver.kt | 1 - .../android/util/platformparameter/FeatureFlagConstants.kt | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt index 2d62cdcd639..8a4504b4372 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/ApplicationLifecycleObserver.kt @@ -1,4 +1,3 @@ - package org.oppia.android.domain.oppialogger.analytics import android.app.Activity 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 6d5d716d730..0e49a39738c 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 @@ -141,7 +141,8 @@ const val ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE = false @Qualifier annotation class EnableInteractionConfigChangeStateRetention -/** Name of the feature flag that controls whether input interaction state is correctly retained +/** + * Name of the feature flag that controls whether input interaction state is correctly retained * across configuration changes. */ const val INTERACTION_CONFIG_CHANGE_STATE_RETENTION = "interaction_config_change_state_retention" From df983b9735facbf46c1e621d5431fcaa7e6dbe82 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Fri, 17 Nov 2023 09:14:07 +0300 Subject: [PATCH 18/20] chore: Remove unused feature flag --- .../util/platformparameter/FeatureFlagConstants.kt | 11 ----------- 1 file changed, 11 deletions(-) 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 0e49a39738c..fdfe77ef820 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 @@ -113,17 +113,6 @@ const val ENABLE_PERFORMANCE_METRICS_COLLECTION = "enable_performance_metrics_co /** Default value for whether to record performance metrics. */ const val ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE = false -/** - * Qualifier for the feature flag that controls whether to animate the continue button - * interaction and navigation items. This is used to disable the animation during testing because - * Espresso has known problems while testing views that contain animations. - */ -@Qualifier -annotation class EnableContinueButtonAnimation - -/** Default value for whether to enable continue button animation. */ -const val ENABLE_CONTINUE_BUTTON_ANIMATION_DEFAULT_VALUE = true - /** Qualifier for the feature flag corresponding to enabling the spotlight UI. */ @Qualifier annotation class EnableSpotlightUi From 8f1d1cc3b4456139a8640ac75e5ac01e85a770a9 Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Fri, 24 Nov 2023 16:48:51 +0300 Subject: [PATCH 19/20] fix: Fix minor linting issues --- .../android/util/platformparameter/FeatureFlagConstants.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fdfe77ef820..dd45a5a3ae2 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 @@ -38,7 +38,7 @@ const val ENABLE_LANGUAGE_SELECTION_UI_DEFAULT_VALUE = true annotation class EnableExtraTopicTabsUi /** Name of the feature flag that controls whether to enable the extra topics tab UI. */ -const val EXTRA_TOPIC_TABS_UI = "extra_topics_tab_ui" +const val EXTRA_TOPIC_TABS_UI = "extra_topic_tabs_ui" /** Default value for the feature flag corresponding to [EnableExtraTopicTabsUi]. */ const val ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE = false From 3e203c4507fd5d353f7ac5f2d9b6abc654ea979f Mon Sep 17 00:00:00 2001 From: Kenneth Murerwa Date: Wed, 29 Nov 2023 09:18:22 +0300 Subject: [PATCH 20/20] chore: Modify the PlatformParameterValue default sync status name --- .../android/util/platformparameter/PlatformParameterValue.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt index 51523f0134f..beefdee92bb 100644 --- a/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt +++ b/utility/src/main/java/org/oppia/android/util/platformparameter/PlatformParameterValue.kt @@ -19,11 +19,11 @@ interface PlatformParameterValue { */ fun createDefaultParameter( defaultValue: T, - defaultIsSynced: SyncStatus = SyncStatus.NOT_SYNCED_FROM_SERVER + defaultSyncStatus: SyncStatus = SyncStatus.NOT_SYNCED_FROM_SERVER ): PlatformParameterValue { return object : PlatformParameterValue { override val value = defaultValue - override val syncStatus = defaultIsSynced + override val syncStatus = defaultSyncStatus } } }