For #26308 - Add feature flag for MR onboarding

This commit is contained in:
sarah541 2022-08-03 16:03:26 -04:00 committed by mergify[bot]
parent cffce104cf
commit bbb602a2fd
5 changed files with 51 additions and 0 deletions

View File

@ -58,6 +58,14 @@ nimbus-validation:
settings-title:
type: string
description: The title of displayed in the Settings screen and app menu.
onboarding:
description: The onboarding features displayed on homescreen.
hasExposure: true
exposureDescription: ""
variables:
sections-enabled:
type: json
description: This property provides a lookup table of whether or not the given section should be enabled.
pocket-sponsored-stories:
description: A feature showing sponsored stories in between the other Pocket recommended stories on homescreen.
hasExposure: true

View File

@ -23,6 +23,11 @@ object FeatureFlags {
*/
const val syncAddressesFeature = false
/**
* Enables the on-boarding sync cfr on the home screen.
*/
val showSynCFR = Config.channel.isDebug
/**
* Enables the "recent" tabs feature in the home screen.
*/

View File

@ -44,6 +44,7 @@ import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.nimbus.FxNimbus
import org.mozilla.fenix.nimbus.HomeScreenSection
import org.mozilla.fenix.nimbus.OnboardingSection
import org.mozilla.fenix.settings.PhoneFeature
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
import org.mozilla.fenix.settings.logins.SavedLoginsSortingStrategyMenu
@ -1200,6 +1201,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = false
)
private val onboardScreenSection: Map<OnboardingSection, Boolean> get() =
FxNimbus.features.onboarding.value().sectionsEnabled
private val homescreenSections: Map<HomeScreenSection, Boolean> get() = try {
FxNimbus.features.homescreen.value().sectionsEnabled
} catch (e: NimbusFeatureException) {
@ -1212,6 +1216,16 @@ class Settings(private val appContext: Context) : PreferencesHolder {
featureFlag = FeatureFlags.historyMetadataUIFeature || isHistoryMetadataEnabled
)
/**
* Indicates if sync on-boarding CFR should be shown
* Returns true if the [FeatureFlags.showSynCFR] and [R.string.pref_key_should_show_sync_cfr] are true.
*/
var showSyncCFR by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_should_show_sync_cfr),
featureFlag = FeatureFlags.showSynCFR,
default = { onboardScreenSection[OnboardingSection.SYNC_CFR] == true },
)
/**
* Indicates if the recent tabs functionality should be visible.
* Returns true if the [FeatureFlags.showRecentTabsFeature] and [R.string.pref_key_recent_tabs] are true.

View File

@ -236,6 +236,8 @@
<string name="pref_key_has_inactive_tabs_auto_close_dialog_dismissed" translatable="false">pref_key_has_inactive_tabs_auto_close_dialog_dismissed</string>
<!-- A value of `true` means the jump back in onboarding popup has not been shown yet -->
<string name="pref_key_should_show_jump_back_in_tabs_popup" translatable="false">pref_key_should_show_jump_back_in_tabs_popup</string>
<!-- A value of `true` means the on-boarding sync CFR have not been shown yet -->
<string name="pref_key_should_show_sync_cfr" translatable="false">pref_key_should_show_sync_cfr</string>
<string name="pref_key_debug_settings" translatable="false">pref_key_debug_settings</string>

View File

@ -33,6 +33,23 @@ features:
"contile-top-sites": false,
}
}
onboarding:
description: The homescreen that the user goes to when they press home or new tab.
variables:
sections-enabled:
description: "This property provides a lookup table of whether or not the given section should be enabled."
type: Map<OnboardingSection, Boolean>
default:
{
"sync-cfr": false
}
defaults:
- channel: nightly
value: {
"sections-enabled": {
"sync-cfr": false
}
}
nimbus-validation:
description: "A feature that does not correspond to an application feature suitable for showing
that Nimbus is working. This should never be used in production."
@ -305,4 +322,9 @@ types:
description: A setting in the settings screen.
homescreen-banner:
description: A banner in the homescreen.
OnboardingSection:
description: The identifiers for the sections of the onboarding.
variants:
sync-cfr:
description: Sync onboarding CFR.