2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-13 07:10:28 +00:00

Bug 1864759 - Add secret setting and feature flag for toolbar redesign

This commit is contained in:
Harrison Oglesby 2023-11-30 13:02:33 -08:00 committed by mergify[bot]
parent 96022dad35
commit 74ca206ed5
7 changed files with 89 additions and 0 deletions

View File

@ -78,4 +78,14 @@ object FeatureFlags {
* Enable Meta attribution.
*/
val metaAttributionEnabled = Config.channel.isNightlyOrDebug
/**
* Enable Toolbar Redesign components and behaviors ready for Nightly.
*/
val completeToolbarRedesignEnabled = Config.channel.isNightlyOrDebug
/**
* Enable Toolbar Redesign partial components and behaviors.
*/
val incompleteToolbarRedesignEnabled = Config.channel.isDebug
}

View File

@ -0,0 +1,42 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.components.toolbar
import org.mozilla.fenix.utils.Settings
/**
* An abstraction for the Toolbar Redesign feature.
*/
interface RedesignToolbarFeature {
/**
* Returns true if the toolbar redesign feature is enabled.
*/
val isEnabled: Boolean
}
/**
* The complete portions of the redesigned Toolbar ready for Nightly.
*
*/
class CompleteRedesignToolbarFeature(
private val settings: Settings,
) : RedesignToolbarFeature {
override val isEnabled: Boolean
get() = settings.enableRedesignToolbar
}
/**
* The incomplete portions of the redesigned Toolbar still in progress.
*
*/
class IncompleteRedesignToolbarFeature(
private val settings: Settings,
) : RedesignToolbarFeature {
override val isEnabled: Boolean
get() = settings.enableIncompleteToolbarRedesign
}

View File

@ -48,6 +48,12 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_toolbar_use_redesign_incomplete).apply {
isVisible = Config.channel.isDebug
isChecked = context.settings().enableIncompleteToolbarRedesign
onPreferenceChangeListener = SharedPreferenceUpdater()
}
requirePreference<SwitchPreference>(R.string.pref_key_enable_tabs_tray_to_compose).apply {
isVisible = true
isChecked = context.settings().enableTabsTrayToCompose

View File

@ -1942,4 +1942,24 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = { enableFxSuggest },
featureFlag = FeatureFlags.fxSuggest,
)
/**
* Indicates if the user is shown new redesigned Toolbar UI.
*/
var enableRedesignToolbar by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_toolbar_use_redesign),
default = { false },
featureFlag = FeatureFlags.completeToolbarRedesignEnabled,
)
/**
* Indicates if the user is shown incomplete new redesigned Toolbar UI components and behaviors.
*
* DEV ONLY
*/
var enableIncompleteToolbarRedesign by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_toolbar_use_redesign_incomplete),
default = { false },
featureFlag = FeatureFlags.incompleteToolbarRedesignEnabled,
)
}

View File

@ -138,6 +138,10 @@
<string name="pref_key_toolbar_top" translatable="false">pref_key_toolbar_top</string>
<string name="pref_key_toolbar_bottom" translatable="false">pref_key_toolbar_bottom</string>
<!-- Toolbar Redesign -->
<string name="pref_key_toolbar_use_redesign" translatable="false">pref_key_toolbar_use_redesign</string>
<string name="pref_key_toolbar_use_redesign_incomplete" translatable="false">pref_key_toolbar_use_redesign_incomplete</string>
<!-- Privacy Pop Window -->
<string name="pref_key_privacy_pop_window" translatable="false">pref_key_privacy_pop_window</string>

View File

@ -70,6 +70,8 @@
<string name="preferences_debug_settings_translations" translatable="false">Enable Firefox Translations</string>
<!-- Label for enabling Firefox Suggest -->
<string name="preferences_debug_settings_fxsuggest" translatable="false">Enable Firefox Suggest</string>
<!-- Label for enabling Toolbar Redesign incomplete portions -->
<string name="preferences_debug_settings_toolbar_redesign" translatable="false">Enable Toolbar Redesign incomplete portions</string>
<!-- Label for enabling Felt Privacy -->
<string name="preferences_debug_felt_privacy" translatable="false">Enable Felt Privacy</string>

View File

@ -25,6 +25,11 @@
android:key="@string/pref_key_enable_compose_top_sites"
android:title="@string/preferences_debug_settings_compose_top_sites"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_toolbar_use_redesign_incomplete"
android:title="@string/preferences_debug_settings_toolbar_redesign"
app:iconSpaceReserved="false" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/pref_key_enable_translations"