Bug 1830768 - Add nimbus flag for toolbar position

(cherry picked from commit e3d2b97b25d43f36e6ade33482de584a4973ffbc)
fenix/115.2.0
sarah541 1 year ago committed by mergify[bot]
parent 69486b7898
commit 933b843e4b

@ -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

@ -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:

@ -887,8 +887,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
@ -926,6 +925,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)

@ -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

Loading…
Cancel
Save