For #26475 - Remove unnecessary features flags

This commit is contained in:
Gabriel Luong 2022-10-22 13:01:24 -04:00 committed by mergify[bot]
parent d5459de3b5
commit 20b396e0cd
8 changed files with 15 additions and 79 deletions

View File

@ -31,41 +31,11 @@ object FeatureFlags {
*/
const val syncAddressesFeature = false
/**
* Enables the onboarding sync CFR on the home screen.
*/
const val showSynCFR = true
/**
* Enables the onboarding jump back in CFR on the home screen.
*/
const val showJumpBackInCFR = true
/**
* Enables the first run onboarding updates.
*/
const val showFirstRunOnboardingUpdates = false
/**
* Enables the "recent" tabs feature in the home screen.
*/
const val showRecentTabsFeature = true
/**
* Enables UI features based on history metadata.
*/
const val historyMetadataUIFeature = true
/**
* Enables the recently saved bookmarks feature in the home screen.
*/
const val recentBookmarksFeature = true
/**
* Identifies and separates the tabs list with a secondary section containing least used tabs.
*/
const val inactiveTabs = true
/**
* Show Pocket recommended stories on home.
*/
@ -82,36 +52,16 @@ object FeatureFlags {
return isPocketRecommendationsFeatureEnabled(context) && Config.channel.isDebug
}
/**
* Enables showing the homescreen onboarding card.
*/
const val showHomeOnboarding = true
/**
* Enables the Task Continuity enhancements.
*/
const val taskContinuityFeature = true
/**
* Enables the Unified Search feature.
*/
val unifiedSearchFeature = Config.channel.isNightlyOrDebug
/**
* Enables receiving from the messaging framework.
*/
const val messagingFeature = true
/**
* Enables compose on the tabs tray items.
*/
val composeTabsTray = Config.channel.isDebug
/**
* Enables the wallpaper onboarding.
*/
const val wallpaperOnboardingEnabled = true
/**
* Enables the wallpaper v2 enhancements.
*/

View File

@ -467,7 +467,7 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
components.core.trackingProtectionPolicyFactory.createTrackingProtectionPolicy()
val settings = settings()
if (FeatureFlags.messagingFeature && settings.isExperimentationEnabled) {
if (settings.isExperimentationEnabled) {
components.appStore.dispatch(AppAction.MessagingAction.Restore)
}
reportHomeScreenSectionMetrics(settings)

View File

@ -5,7 +5,6 @@
package org.mozilla.fenix.gleanplumb
import mozilla.components.support.base.feature.LifecycleAwareFeature
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.components.AppStore
import org.mozilla.fenix.components.appstate.AppAction.MessagingAction
@ -15,9 +14,7 @@ import org.mozilla.fenix.components.appstate.AppAction.MessagingAction
class MessagingFeature(val appStore: AppStore) : LifecycleAwareFeature {
override fun start() {
if (FeatureFlags.messagingFeature) {
appStore.dispatch(MessagingAction.Evaluate)
}
appStore.dispatch(MessagingAction.Evaluate)
}
override fun stop() = Unit

View File

@ -68,7 +68,6 @@ class HomeSettingsFragment : PreferenceFragmentCompat() {
}
requirePreference<SwitchPreference>(R.string.pref_key_recent_tabs).apply {
isVisible = FeatureFlags.showRecentTabsFeature
isChecked = context.settings().showRecentTabsFeature
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
@ -85,7 +84,6 @@ class HomeSettingsFragment : PreferenceFragmentCompat() {
}
requirePreference<SwitchPreference>(R.string.pref_key_recent_bookmarks).apply {
isVisible = FeatureFlags.recentBookmarksFeature
isChecked = context.settings().showRecentBookmarksFeature
onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {

View File

@ -10,7 +10,6 @@ import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import mozilla.telemetry.glean.private.NoExtras
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Tabs
import org.mozilla.fenix.R
@ -67,7 +66,6 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
}
inactiveTabsCategory = requirePreference<PreferenceCategory>(R.string.pref_key_inactive_tabs_category).also {
it.isVisible = FeatureFlags.inactiveTabs
it.isEnabled = !(it.context.settings().closeTabsAfterOneDay || it.context.settings().closeTabsAfterOneWeek)
}

View File

@ -238,7 +238,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var showWallpaperOnboarding by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_wallpapers_onboarding),
featureFlag = FeatureFlags.wallpaperOnboardingEnabled,
featureFlag = true,
default = { mr2022Sections[Mr2022Section.WALLPAPERS_SELECTION_TOOL] == true },
)
@ -450,10 +450,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
/**
* Indicates if the user has enabled the inactive tabs feature.
*/
var inactiveTabsAreEnabled by featureFlagPreference(
var inactiveTabsAreEnabled by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_inactive_tabs),
default = FeatureFlags.inactiveTabs,
featureFlag = FeatureFlags.inactiveTabs,
default = true,
)
@VisibleForTesting
@ -910,7 +909,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var shouldShowJumpBackInCFR by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_should_show_jump_back_in_tabs_popup),
featureFlag = FeatureFlags.showJumpBackInCFR,
featureFlag = true,
default = { mr2022Sections[Mr2022Section.JUMP_BACK_IN_CFR] == true },
)
@ -1271,7 +1270,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var showSyncCFR by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_should_show_sync_cfr),
featureFlag = FeatureFlags.showSynCFR,
featureFlag = true,
default = { mr2022Sections[Mr2022Section.SYNC_CFR] == true },
)
@ -1280,28 +1279,26 @@ class Settings(private val appContext: Context) : PreferencesHolder {
*/
var showHomeOnboardingDialog by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_should_show_home_onboarding_dialog),
featureFlag = FeatureFlags.showHomeOnboarding,
featureFlag = true,
default = { mr2022Sections[Mr2022Section.HOME_ONBOARDING_DIALOG_EXISTING_USERS] == 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.
*/
var showRecentTabsFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_recent_tabs),
featureFlag = FeatureFlags.showRecentTabsFeature,
featureFlag = true,
default = { homescreenSections[HomeScreenSection.JUMP_BACK_IN] == true },
)
/**
* Indicates if the recent saved bookmarks functionality should be visible.
* Returns true if the [FeatureFlags.showRecentTabsFeature] and [R.string.pref_key_recent_bookmarks] are true.
*/
var showRecentBookmarksFeature by lazyFeatureFlagPreference(
appContext.getPreferenceKey(R.string.pref_key_recent_bookmarks),
default = { homescreenSections[HomeScreenSection.RECENTLY_SAVED] == true },
featureFlag = FeatureFlags.recentBookmarksFeature,
featureFlag = true,
)
/**
@ -1378,10 +1375,9 @@ class Settings(private val appContext: Context) : PreferencesHolder {
/**
* Indicates if the Task Continuity enhancements are enabled.
*/
var enableTaskContinuityEnhancements by featureFlagPreference(
var enableTaskContinuityEnhancements by booleanPreference(
key = appContext.getPreferenceKey(R.string.pref_key_enable_task_continuity),
default = FeatureFlags.taskContinuityFeature,
featureFlag = FeatureFlags.taskContinuityFeature,
default = true,
)
/**

View File

@ -17,13 +17,11 @@
<androidx.preference.SwitchPreference
android:key="@string/pref_key_recent_tabs"
android:title="@string/customize_toggle_jump_back_in"
app:isPreferenceVisible="false" />
android:title="@string/customize_toggle_jump_back_in" />
<androidx.preference.SwitchPreference
android:key="@string/pref_key_recent_bookmarks"
android:title="@string/customize_toggle_recent_bookmarks"
app:isPreferenceVisible="false" />
android:title="@string/customize_toggle_recent_bookmarks" />
<androidx.preference.SwitchPreference
android:key="@string/pref_key_history_metadata_feature"

View File

@ -51,8 +51,7 @@
android:title="@string/preferences_inactive_tabs"
android:key="@string/pref_key_inactive_tabs_category"
app:allowDividerAbove="true"
app:iconSpaceReserved="false"
app:isPreferenceVisible="false">
app:iconSpaceReserved="false">
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_inactive_tabs"