Close #17928: Add feature flag for tabs tray refactor
This commit is contained in:
parent
319883d951
commit
607d6382f8
|
@ -28,4 +28,9 @@ object FeatureFlags {
|
|||
* Shows new three-dot toolbar menu design.
|
||||
*/
|
||||
val toolbarMenuFeature = Config.channel.isDebug
|
||||
|
||||
/**
|
||||
* Enables the tabs tray re-write with Synced Tabs.
|
||||
*/
|
||||
val tabsTrayRewrite = Config.channel.isNightlyOrDebug
|
||||
}
|
||||
|
|
|
@ -6,7 +6,10 @@ package org.mozilla.fenix.settings
|
|||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SwitchPreference
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.ext.showToolbar
|
||||
|
||||
class SecretSettingsFragment : PreferenceFragmentCompat() {
|
||||
|
@ -18,5 +21,11 @@ class SecretSettingsFragment : PreferenceFragmentCompat() {
|
|||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.secret_settings_preferences, rootKey)
|
||||
|
||||
requirePreference<SwitchPreference>(R.string.pref_key_new_tabs_tray).apply {
|
||||
isVisible = FeatureFlags.tabsTrayRewrite
|
||||
isChecked = context.settings().tabsTrayRewrite
|
||||
onPreferenceChangeListener = SharedPreferenceUpdater()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,12 @@ import mozilla.components.support.ktx.android.content.longPreference
|
|||
import mozilla.components.support.ktx.android.content.stringPreference
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||
import org.mozilla.fenix.components.metrics.MozillaProductDetector
|
||||
import org.mozilla.fenix.components.settings.counterPreference
|
||||
import org.mozilla.fenix.components.settings.featureFlagPreference
|
||||
import org.mozilla.fenix.components.toolbar.ToolbarPosition
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.getPreferenceKey
|
||||
|
@ -319,6 +321,12 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
|||
default = false
|
||||
)
|
||||
|
||||
var tabsTrayRewrite by featureFlagPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_new_tabs_tray),
|
||||
default = false,
|
||||
featureFlag = FeatureFlags.tabsTrayRewrite
|
||||
)
|
||||
|
||||
fun getTabTimeout(): Long = when {
|
||||
closeTabsAfterOneDay -> ONE_DAY_MS
|
||||
closeTabsAfterOneWeek -> ONE_WEEK_MS
|
||||
|
|
|
@ -236,6 +236,7 @@
|
|||
<string name="pref_key_close_tabs_after_one_day" translatable="false">pref_key_close_tabs_after_one_day</string>
|
||||
<string name="pref_key_close_tabs_after_one_week" translatable="false">pref_key_close_tabs_after_one_week</string>
|
||||
<string name="pref_key_close_tabs_after_one_month" translatable="false">pref_key_close_tabs_after_one_month</string>
|
||||
<string name="pref_key_new_tabs_tray" translatable="false">pref_key_new_tabs_tray</string>
|
||||
|
||||
<string name="pref_key_camera_permissions_needed" translatable="false">pref_key_camera_permissions_needed</string>
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
<string name="preferences_debug_settings">Secret Settings</string>
|
||||
<!-- Label for the secret settings preference -->
|
||||
<string name="preferences_debug_info" translatable="false">Secret Debug Info</string>
|
||||
<!-- Label for the new tabs tray preference -->
|
||||
<string name="preferences_debug_settings_tabs_tray_rewrite">Use new Tabs Tray</string>
|
||||
<!-- Label for a longer description of the new tabs tray preference -->
|
||||
<string name="preferences_debug_settings_tabs_tray_rewrite_summary">A refactored tabs tray that will include Synced Tabs.</string>
|
||||
|
||||
<!-- Label for showing Synced Tabs in the tabs tray -->
|
||||
<string name="preferences_debug_synced_tabs_tabs_tray">Show Synced Tabs in the tabs tray</string>
|
||||
|
|
|
@ -4,4 +4,10 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key_new_tabs_tray"
|
||||
android:title="@string/preferences_debug_settings_tabs_tray_rewrite"
|
||||
android:summary="@string/preferences_debug_settings_tabs_tray_rewrite_summary"
|
||||
app:iconSpaceReserved="false" />
|
||||
</PreferenceScreen>
|
||||
|
|
Loading…
Reference in New Issue