diff --git a/app/.experimenter.yaml b/app/.experimenter.yaml index da2325a89a..0fe5593ef3 100644 --- a/app/.experimenter.yaml +++ b/app/.experimenter.yaml @@ -147,6 +147,14 @@ search-term-groups: enabled: type: boolean description: "If true, the feature shows up on the homescreen and on the new tab screen." +toolbar: + description: The searchbar/awesomebar that user uses to search. + hasExposure: true + exposureDescription: "" + variables: + toolbar-position-top: + type: boolean + description: "If true, toolbar appears at top of the screen." unified-search: description: A feature allowing user to easily search for specified results directly in the search bar. hasExposure: true diff --git a/app/nimbus.fml.yaml b/app/nimbus.fml.yaml index e4fafc3d2c..3a9dd7888d 100644 --- a/app/nimbus.fml.yaml +++ b/app/nimbus.fml.yaml @@ -142,6 +142,13 @@ import: } features: + toolbar: + description: The searchbar/awesomebar that user uses to search. + variables: + toolbar-position-top: + description: If true, toolbar appears at top of the screen. + type: Boolean + default: false homescreen: description: The homescreen that the user goes to when they press home or new tab. variables: diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 7d4febd284..0b0aeaa0ef 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -877,8 +877,7 @@ class Settings(private val appContext: Context) : PreferencesHolder { var shouldUseBottomToolbar by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_toolbar_bottom), - // Default accessibility users to top toolbar - default = !touchExplorationIsEnabled && !switchServiceIsEnabled, + default = shouldDefaultToBottomToolbar(), ) val toolbarPosition: ToolbarPosition @@ -916,6 +915,18 @@ class Settings(private val appContext: Context) : PreferencesHolder { return touchExplorationIsEnabled || switchServiceIsEnabled } + val toolbarPositionTop: Boolean + get() = FxNimbus.features.toolbar.value().toolbarPositionTop + + /** + * Checks if we should default to bottom toolbar. + */ + fun shouldDefaultToBottomToolbar(): Boolean { + // Default accessibility users to top toolbar + return (!touchExplorationIsEnabled && !switchServiceIsEnabled) && + !toolbarPositionTop + } + fun getDeleteDataOnQuit(type: DeleteBrowsingDataOnQuitType): Boolean = preferences.getBoolean(type.getPreferenceKey(appContext), false) diff --git a/app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt b/app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt index 320ebb99eb..35bd7daa59 100644 --- a/app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt +++ b/app/src/test/java/org/mozilla/fenix/utils/SettingsTest.kt @@ -878,6 +878,15 @@ class SettingsTest { assertTrue(actual) } + @Test + fun `GIVEN toolbarPositionTop is false, touchExplorationIsEnabled is true THEN shouldDefaultToBottomToolbar returns false`() { + val settings = spyk(settings) + every { settings.toolbarPositionTop } returns true + every { settings.touchExplorationIsEnabled } returns true + + assertEquals(false, settings.shouldDefaultToBottomToolbar()) + } + @Test fun `GIVEN Https-only mode is disabled THEN the engine mode is HttpsOnlyMode#DISABLED`() { settings.shouldUseHttpsOnly = false