Commit 49cabef3 authored by Roger Yang's avatar Roger Yang
Browse files

Bug 1917640 - Update toolbar default position to top r=android-reviewers,skhan,harrisono

parent 16d3f6f7
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -224,14 +224,6 @@ splash-screen:
    maximum_duration_ms:
      type: int
      description: The maximum amount of time in milliseconds the splashscreen will be visible while waiting for initialization calls to complete.
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
+0 −7
Original line number Diff line number Diff line
@@ -35,13 +35,6 @@ 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:
+5 −0
Original line number Diff line number Diff line
@@ -104,6 +104,11 @@ interface FeatureSettingsHelper {
     */
    var isSetAsDefaultBrowserPromptEnabled: Boolean

    /**
     * Enable or disable bottom toolbar position.
     */
    var shouldUseBottomToolbar: Boolean

    fun applyFlagUpdates()

    fun resetAllFeatureFlags()
+4 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ class FeatureSettingsHelperDelegate() : FeatureSettingsHelper {
        isNavigationToolbarEnabled = settings.navigationToolbarEnabled,
        isMicrosurveyEnabled = settings.microsurveyFeatureEnabled,
        isSetAsDefaultBrowserPromptEnabled = settings.setAsDefaultBrowserPromptForExistingUsersEnabled,
        shouldUseBottomToolbar = settings.shouldUseBottomToolbar,
    )

    /**
@@ -80,6 +81,7 @@ class FeatureSettingsHelperDelegate() : FeatureSettingsHelper {
    override var isNavigationToolbarEnabled: Boolean by updatedFeatureFlags::isNavigationToolbarEnabled
    override var isMicrosurveyEnabled: Boolean by updatedFeatureFlags::isMicrosurveyEnabled
    override var isSetAsDefaultBrowserPromptEnabled: Boolean by updatedFeatureFlags::isSetAsDefaultBrowserPromptEnabled
    override var shouldUseBottomToolbar: Boolean by updatedFeatureFlags::shouldUseBottomToolbar

    override fun applyFlagUpdates() {
        Log.i(TAG, "applyFlagUpdates: Trying to apply the updated feature flags: $updatedFeatureFlags")
@@ -112,6 +114,7 @@ class FeatureSettingsHelperDelegate() : FeatureSettingsHelper {
        settings.navigationToolbarEnabled = featureFlags.isNavigationToolbarEnabled
        settings.microsurveyFeatureEnabled = featureFlags.isMicrosurveyEnabled
        settings.setAsDefaultBrowserPromptForExistingUsersEnabled = featureFlags.isSetAsDefaultBrowserPromptEnabled
        settings.shouldUseBottomToolbar = featureFlags.shouldUseBottomToolbar
        setETPPolicy(featureFlags.etpPolicy)
        setPermissions(PhoneFeature.LOCATION, featureFlags.isLocationPermissionEnabled)
    }
@@ -136,6 +139,7 @@ private data class FeatureFlags(
    var isNavigationToolbarEnabled: Boolean,
    var isMicrosurveyEnabled: Boolean,
    var isSetAsDefaultBrowserPromptEnabled: Boolean,
    var shouldUseBottomToolbar: Boolean,
)

internal fun getETPPolicy(settings: Settings): ETPPolicy {
+11 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ class HomeActivityTestRule(
        isNavigationToolbarEnabled: Boolean = false,
        isMicrosurveyEnabled: Boolean = settings.microsurveyFeatureEnabled,
        isSetAsDefaultBrowserPromptEnabled: Boolean = settings.setAsDefaultBrowserPromptForExistingUsersEnabled,
        shouldUseBottomToolbar: Boolean = settings.shouldUseBottomToolbar,
    ) : this(initialTouchMode, launchActivity, skipOnboarding) {
        this.isHomeOnboardingDialogEnabled = isHomeOnboardingDialogEnabled
        this.isPocketEnabled = isPocketEnabled
@@ -82,6 +83,7 @@ class HomeActivityTestRule(
        this.isNavigationToolbarEnabled = isNavigationToolbarEnabled
        this.isMicrosurveyEnabled = isMicrosurveyEnabled
        this.isSetAsDefaultBrowserPromptEnabled = isSetAsDefaultBrowserPromptEnabled
        this.shouldUseBottomToolbar = shouldUseBottomToolbar
    }

    /**
@@ -144,6 +146,9 @@ class HomeActivityTestRule(
            composeTopSitesEnabled = composeTopSitesEnabled,
            isMicrosurveyEnabled = false,
            isSetAsDefaultBrowserPromptEnabled = false,
            // workaround for toolbar at top position by default
            // remove with https://bugzilla.mozilla.org/show_bug.cgi?id=1917640
            shouldUseBottomToolbar = true,
        )
    }
}
@@ -187,6 +192,7 @@ class HomeActivityIntentTestRule internal constructor(
        isNavigationToolbarEnabled: Boolean = false,
        isMicrosurveyEnabled: Boolean = settings.microsurveyFeatureEnabled,
        isSetAsDefaultBrowserPromptEnabled: Boolean = settings.setAsDefaultBrowserPromptForExistingUsersEnabled,
        shouldUseBottomToolbar: Boolean = settings.shouldUseBottomToolbar,
    ) : this(initialTouchMode, launchActivity, skipOnboarding) {
        this.isHomeOnboardingDialogEnabled = isHomeOnboardingDialogEnabled
        this.isPocketEnabled = isPocketEnabled
@@ -205,6 +211,7 @@ class HomeActivityIntentTestRule internal constructor(
        this.isNavigationToolbarEnabled = isNavigationToolbarEnabled
        this.isMicrosurveyEnabled = isMicrosurveyEnabled
        this.isSetAsDefaultBrowserPromptEnabled = isSetAsDefaultBrowserPromptEnabled
        this.shouldUseBottomToolbar = shouldUseBottomToolbar
    }

    private val longTapUserPreference = getLongPressTimeout()
@@ -278,6 +285,7 @@ class HomeActivityIntentTestRule internal constructor(
        isNavigationToolbarEnabled = settings.navigationToolbarEnabled
        isMicrosurveyEnabled = settings.microsurveyFeatureEnabled
        isSetAsDefaultBrowserPromptEnabled = settings.setAsDefaultBrowserPromptForExistingUsersEnabled
        shouldUseBottomToolbar = settings.shouldUseBottomToolbar
    }

    companion object {
@@ -308,6 +316,9 @@ class HomeActivityIntentTestRule internal constructor(
            composeTopSitesEnabled = composeTopSitesEnabled,
            isMicrosurveyEnabled = false,
            isSetAsDefaultBrowserPromptEnabled = false,
            // workaround for toolbar at top position by default
            // remove with https://bugzilla.mozilla.org/show_bug.cgi?id=1917640
            shouldUseBottomToolbar = true,
        )
    }
}
Loading