tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 0d6e36f91d40732c53ca05207fdd62e82118b21b
parent f06208ee3fb1188af2e93963d3ffd31f4b249ec5
Author: iulian moraru <imoraru@mozilla.com>
Date:   Fri, 21 Nov 2025 04:49:40 +0200

Revert "Bug 2000490 - Add Toolbar CFR. r=android-reviewers,android-l10n-reviewers,petru,flod" for causing fenix build failures.

This reverts commit 6962ca53f81a7c973708cd32eae5055af66601bb.

Diffstat:
Mmobile/android/android-components/.buildconfig.yml | 3---
Mmobile/android/android-components/components/compose/browser-toolbar/build.gradle | 1-
Mmobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt | 99++++++++-----------------------------------------------------------------------
Mmobile/android/android-components/components/compose/browser-toolbar/src/main/res/values/strings.xml | 4----
Mmobile/android/android-components/components/compose/cfr/src/main/java/mozilla/components/compose/cfr/CFRPopup.kt | 2+-
Mmobile/android/fenix/app/metrics.yaml | 26--------------------------
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelper.kt | 5-----
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelperDelegate.kt | 4----
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt | 5-----
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarComposable.kt | 57+++------------------------------------------------------
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt | 8--------
Mmobile/android/fenix/app/src/main/res/values/preference_keys.xml | 3+--
12 files changed, 14 insertions(+), 203 deletions(-)

diff --git a/mobile/android/android-components/.buildconfig.yml b/mobile/android/android-components/.buildconfig.yml @@ -324,7 +324,6 @@ projects: - components:browser-menu2 - components:browser-state - components:compose-base - - components:compose-cfr - components:concept-awesomebar - components:concept-base - components:concept-engine @@ -1827,7 +1826,6 @@ projects: - components:compose-awesomebar - components:compose-base - components:compose-browser-toolbar - - components:compose-cfr - components:compose-engine - components:compose-tabstray - components:concept-awesomebar @@ -2002,7 +2000,6 @@ projects: - components:browser-toolbar - components:compose-base - components:compose-browser-toolbar - - components:compose-cfr - components:concept-awesomebar - components:concept-base - components:concept-engine diff --git a/mobile/android/android-components/components/compose/browser-toolbar/build.gradle b/mobile/android/android-components/components/compose/browser-toolbar/build.gradle @@ -25,7 +25,6 @@ dependencies { implementation project(":components:browser-menu2") implementation project(":components:browser-state") implementation project(":components:compose-base") - implementation project(":components:compose-cfr") implementation project(":components:concept-engine") implementation project(":components:concept-menu") implementation project(":components:feature-session") diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt b/mobile/android/android-components/components/compose/browser-toolbar/src/main/java/mozilla/components/compose/browser/toolbar/BrowserToolbar.kt @@ -4,14 +4,10 @@ package mozilla.components.compose.browser.toolbar -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember -import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.PreviewLightDark -import androidx.compose.ui.unit.dp import mozilla.components.compose.base.theme.AcornTheme import mozilla.components.compose.browser.toolbar.concept.PageOrigin import mozilla.components.compose.browser.toolbar.store.BrowserEditToolbarAction.SearchQueryUpdated @@ -22,33 +18,9 @@ import mozilla.components.compose.browser.toolbar.store.BrowserToolbarStore import mozilla.components.compose.browser.toolbar.store.DisplayState import mozilla.components.compose.browser.toolbar.store.EditState import mozilla.components.compose.browser.toolbar.store.Mode -import mozilla.components.compose.browser.toolbar.store.ToolbarGravity import mozilla.components.compose.browser.toolbar.ui.BrowserToolbarQuery -import mozilla.components.compose.cfr.CFRPopup -import mozilla.components.compose.cfr.CFRPopupLayout -import mozilla.components.compose.cfr.CFRPopupProperties import mozilla.components.lib.state.ext.observeAsComposableState -private const val CFR_HORIZONTAL_OFFSET = 160 -private const val CFR_VERTICAL_OFFSET = 0 - -/** - * Represents the state and behavior of a CFR shown in the browser toolbar. - * - * @property enabled Whether the CFR is currently active and should be displayed. - * @property title The headline text displayed in the CFR banner. - * @property description A short descriptive message explaining the feature or action. - * @property onShown Callback invoked when the CFR is first shown to the user. - * @property onDismiss Callback invoked when the CFR is dismissed. - */ -data class BrowserToolbarCFR( - val enabled: Boolean, - val title: String, - val description: String, - val onShown: () -> Unit = {}, - val onDismiss: (Boolean) -> Unit = {}, -) - /** * A customizable toolbar for browsers. * @@ -57,15 +29,12 @@ data class BrowserToolbarCFR( * implemented by the [BrowserDisplayToolbar] and [BrowserEditToolbar] composables. * * @param store The [BrowserToolbarStore] to observe the UI state from. - * @param cfr The [BrowserToolbarCFR] to hold properties of Toolbar's CFR. */ @Composable fun BrowserToolbar( store: BrowserToolbarStore, - cfr: BrowserToolbarCFR? = null, ) { val uiState by store.observeAsComposableState { it } - val cfrProperties = browserToolbarCFRProperties(uiState.gravity) if (uiState.isEditMode()) { BrowserEditToolbar( @@ -82,65 +51,15 @@ fun BrowserToolbar( onInteraction = { store.dispatch(it) }, ) } else { - CFRPopupLayout( - showCFR = cfr?.enabled == true, - properties = cfrProperties, - onCFRShown = { cfr?.onShown?.invoke() }, - onDismiss = { explicit -> cfr?.onDismiss?.invoke(explicit) }, - title = { - cfr?.title?.let { - Text( - text = it, - color = AcornTheme.colors.textOnColorPrimary, - style = AcornTheme.typography.subtitle2, - ) - } - }, - text = { - cfr?.description?.let { - Text( - text = it, - color = AcornTheme.colors.textOnColorPrimary, - style = AcornTheme.typography.body2, - ) - } - }, - ) { - BrowserDisplayToolbar( - pageOrigin = uiState.displayState.pageOrigin, - progressBarConfig = uiState.displayState.progressBarConfig, - gravity = uiState.gravity, - browserActionsStart = uiState.displayState.browserActionsStart, - pageActionsStart = uiState.displayState.pageActionsStart, - pageActionsEnd = uiState.displayState.pageActionsEnd, - browserActionsEnd = uiState.displayState.browserActionsEnd, - onInteraction = { store.dispatch(it) }, - ) - } - } -} - -@Composable -private fun browserToolbarCFRProperties( - gravity: ToolbarGravity, -): CFRPopupProperties { - val isBottom = gravity == ToolbarGravity.Bottom - val indicatorDir = - if (isBottom) CFRPopup.IndicatorDirection.DOWN else CFRPopup.IndicatorDirection.UP - - val colors = AcornTheme.colors - - return remember(isBottom) { - CFRPopupProperties( - popupAlignment = CFRPopup.PopupAlignment.INDICATOR_CENTERED_IN_ANCHOR, - popupBodyColors = listOf( - colors.layerGradientEnd.toArgb(), - colors.layerGradientStart.toArgb(), - ), - dismissButtonColor = colors.iconOnColor.toArgb(), - indicatorDirection = indicatorDir, - popupVerticalOffset = CFR_VERTICAL_OFFSET.dp, - indicatorArrowStartOffset = CFR_HORIZONTAL_OFFSET.dp, + BrowserDisplayToolbar( + pageOrigin = uiState.displayState.pageOrigin, + progressBarConfig = uiState.displayState.progressBarConfig, + gravity = uiState.gravity, + browserActionsStart = uiState.displayState.browserActionsStart, + pageActionsStart = uiState.displayState.pageActionsStart, + pageActionsEnd = uiState.displayState.pageActionsEnd, + browserActionsEnd = uiState.displayState.browserActionsEnd, + onInteraction = { store.dispatch(it) }, ) } } diff --git a/mobile/android/android-components/components/compose/browser-toolbar/src/main/res/values/strings.xml b/mobile/android/android-components/components/compose/browser-toolbar/src/main/res/values/strings.xml @@ -13,8 +13,4 @@ <string name="mozac_browser_toolbar_long_press_popup_paste">Paste</string> <!-- Contextual menu option for long pressing on the toolbar URL. Clicking it will paste the text from clipboard and search for or load it as an URL. '&amp;' is replaced with the ampersand symbol: & --> <string name="mozac_browser_toolbar_long_press_popup_paste_and_go">Paste &amp; Go</string> - <!-- Text for the title displayed in the contextual feature recommendation popup promoting the new toolbar redesign. --> - <string name="mozac_toolbar_cfr_title">Designed for Android. Refined for You</string> - <!-- Text for the description displayed in the contextual feature recommendation popup promoting the new toolbar redesign. --> - <string name="mozac_toolbar_cfr_description">We’ve refreshed the design with a sleek, modern feel</string> </resources> diff --git a/mobile/android/android-components/components/compose/cfr/src/main/java/mozilla/components/compose/cfr/CFRPopup.kt b/mobile/android/android-components/components/compose/cfr/src/main/java/mozilla/components/compose/cfr/CFRPopup.kt @@ -40,7 +40,7 @@ import java.lang.ref.WeakReference * the indicator arrow will be pointing to the middle of the anchor. * @property popupStartOffset Maximum distance between the popup and anchor start. */ -class CFRPopupProperties( +data class CFRPopupProperties( val popupWidth: Dp = CFRPopup.DEFAULT_WIDTH.dp, val popupAlignment: PopupAlignment = PopupAlignment.BODY_TO_ANCHOR_CENTER, val popupBodyColors: List<Int> = listOf(Color.Blue.toArgb()), diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml @@ -14373,32 +14373,6 @@ client_association: - fx-accounts toolbar: - cfr_shown: - type: event - description: | - Toolbar cfr was shown to the user. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=2000490 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=2000490 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - expires: never - cfr_dismissed: - type: event - description: | - Toolbar cfr was dismissed by the user. - bugs: - - https://bugzilla.mozilla.org/show_bug.cgi?id=2000490 - data_reviews: - - https://bugzilla.mozilla.org/show_bug.cgi?id=2000490 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - expires: never button_tapped: type: event description: | diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelper.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelper.kt @@ -135,11 +135,6 @@ interface FeatureSettingsHelper { var tabManagerOpeningAnimationEnabled: Boolean /** - * Indicates if the toolbar CFR was displayed to the user. - */ - var hasSeenBrowserToolbarCFR: Boolean - - /** * Enable or disable the translations prompt after a page that can be translated is loaded. */ fun enableOrDisablePageLoadTranslationsPrompt(enableTranslationsPrompt: Boolean) { diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelperDelegate.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelperDelegate.kt @@ -51,7 +51,6 @@ class FeatureSettingsHelperDelegate : FeatureSettingsHelper { isComposeLoginsEnabled = settings.enableComposeLogins, openLinksInApp = getOpenLinksInApp(settings), tabManagerOpeningAnimationEnabled = settings.tabManagerOpeningAnimationEnabled, - hasSeenBrowserToolbarCFR = settings.hasSeenBrowserToolbarCFR, ) /** @@ -81,7 +80,6 @@ class FeatureSettingsHelperDelegate : FeatureSettingsHelper { override var isComposeLoginsEnabled: Boolean by updatedFeatureFlags::isComposeLoginsEnabled override var openLinksInExternalApp: OpenLinksInApp by updatedFeatureFlags::openLinksInApp override var tabManagerOpeningAnimationEnabled: Boolean by updatedFeatureFlags::tabManagerOpeningAnimationEnabled - override var hasSeenBrowserToolbarCFR: Boolean by updatedFeatureFlags::hasSeenBrowserToolbarCFR override fun applyFlagUpdates() { Log.i(TAG, "applyFlagUpdates: Trying to apply the updated feature flags: $updatedFeatureFlags") @@ -121,7 +119,6 @@ class FeatureSettingsHelperDelegate : FeatureSettingsHelper { settings.enableComposeLogins = featureFlags.isComposeLoginsEnabled setOpenLinksInApp(featureFlags.openLinksInApp) settings.tabManagerOpeningAnimationEnabled = featureFlags.tabManagerOpeningAnimationEnabled - settings.hasSeenBrowserToolbarCFR = featureFlags.hasSeenBrowserToolbarCFR } } @@ -149,7 +146,6 @@ private data class FeatureFlags( var isComposeLoginsEnabled: Boolean, var openLinksInApp: OpenLinksInApp, var tabManagerOpeningAnimationEnabled: Boolean, - var hasSeenBrowserToolbarCFR: Boolean, ) internal fun getETPPolicy(settings: Settings): ETPPolicy { diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/HomeActivityTestRule.kt @@ -73,7 +73,6 @@ class HomeActivityTestRule( isTermsOfServiceAccepted: Boolean = true, isComposeLoginsEnabled: Boolean = false, openLinksInExternalApp: OpenLinksInApp = getOpenLinksInApp(settings), - hasSeenBrowserToolbarCFR: Boolean = true, ) : this(initialTouchMode, launchActivity, skipOnboarding) { this.isHomepageHeaderEnabled = isHomepageHeaderEnabled this.isPocketEnabled = isPocketEnabled @@ -97,7 +96,6 @@ class HomeActivityTestRule( this.isTermsOfServiceAccepted = isTermsOfServiceAccepted this.isComposeLoginsEnabled = isComposeLoginsEnabled this.openLinksInExternalApp = openLinksInExternalApp - this.hasSeenBrowserToolbarCFR = hasSeenBrowserToolbarCFR } /** @@ -211,7 +209,6 @@ class HomeActivityIntentTestRule internal constructor( isComposeLoginsEnabled: Boolean = false, openLinksInExternalApp: OpenLinksInApp = getOpenLinksInApp(settings), tabManagerOpeningAnimationEnabled: Boolean = false, - hasSeenBrowserToolbarCFR: Boolean = true, ) : this(initialTouchMode, launchActivity, skipOnboarding) { this.isHomepageHeaderEnabled = isHomepageHeaderEnabled this.isPocketEnabled = isPocketEnabled @@ -236,7 +233,6 @@ class HomeActivityIntentTestRule internal constructor( this.isComposeLoginsEnabled = isComposeLoginsEnabled this.openLinksInExternalApp = openLinksInExternalApp this.tabManagerOpeningAnimationEnabled = tabManagerOpeningAnimationEnabled - this.hasSeenBrowserToolbarCFR = hasSeenBrowserToolbarCFR } private val longTapUserPreference = getLongPressTimeout() @@ -313,7 +309,6 @@ class HomeActivityIntentTestRule internal constructor( isComposeLoginsEnabled = settings.enableComposeLogins openLinksInExternalApp = getOpenLinksInApp(settings) tabManagerOpeningAnimationEnabled = settings.tabManagerOpeningAnimationEnabled - hasSeenBrowserToolbarCFR = settings.hasSeenBrowserToolbarCFR } companion object { diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarComposable.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarComposable.kt @@ -16,16 +16,12 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.stringResource import androidx.coordinatorlayout.widget.CoordinatorLayout.LayoutParams import mozilla.components.browser.state.action.AwesomeBarAction -import mozilla.components.browser.state.selector.selectedTab import mozilla.components.browser.state.state.CustomTabSessionState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.compose.base.utils.BackInvokedHandler import mozilla.components.compose.browser.toolbar.BrowserToolbar -import mozilla.components.compose.browser.toolbar.BrowserToolbarCFR -import mozilla.components.compose.browser.toolbar.R import mozilla.components.compose.browser.toolbar.store.BrowserToolbarAction.ToolbarGravityUpdated import mozilla.components.compose.browser.toolbar.store.BrowserToolbarStore import mozilla.components.compose.browser.toolbar.store.ToolbarGravity @@ -33,8 +29,6 @@ import mozilla.components.compose.browser.toolbar.store.ToolbarGravity.Bottom import mozilla.components.compose.browser.toolbar.store.ToolbarGravity.Top import mozilla.components.feature.toolbar.ToolbarBehaviorController import mozilla.components.lib.state.ext.observeAsComposableState -import mozilla.telemetry.glean.private.NoExtras -import org.mozilla.fenix.GleanMetrics.Toolbar import org.mozilla.fenix.browser.store.BrowserScreenStore import org.mozilla.fenix.components.AppStore import org.mozilla.fenix.components.appstate.AppAction.SearchAction.SearchEnded @@ -94,8 +88,6 @@ class BrowserToolbarComposable( val customColors = browserScreenStore.observeAsComposableState { it.customTabColors } val shouldUseBottomToolbar = remember(settings) { settings.shouldUseBottomToolbar } - var toolbarCFR = toolbarCFRData(browserStore, settings, customTabSession) - DisposableEffect(activity) { val toolbarController = ToolbarBehaviorController( toolbar = this@BrowserToolbarComposable, @@ -140,10 +132,7 @@ class BrowserToolbarComposable( .wrapContentHeight(), ) { tabStripContent() - BrowserToolbar( - store = toolbarStore, - cfr = toolbarCFR, - ) + BrowserToolbar(toolbarStore) if (customTabSession == null) { searchSuggestionsContent(Modifier.weight(1f)) } @@ -158,16 +147,10 @@ class BrowserToolbarComposable( if (customTabSession == null) { searchSuggestionsContent(Modifier.weight(1f)) } - BrowserToolbar( - store = toolbarStore, - cfr = toolbarCFR, - ) + BrowserToolbar(toolbarStore) navigationBarContent?.invoke() } else { - BrowserToolbar( - store = toolbarStore, - cfr = toolbarCFR, - ) + BrowserToolbar(toolbarStore) if (customTabSession == null) { searchSuggestionsContent(Modifier.weight(1f)) } @@ -205,37 +188,3 @@ class BrowserToolbarComposable( false -> Top } } - -@Composable -private fun toolbarCFRData( - browserStore: BrowserStore, - settings: Settings, - customTabSession: CustomTabSessionState?, -): BrowserToolbarCFR? { - if (settings.hasSeenBrowserToolbarCFR || !settings.toolbarRedesignEnabled || customTabSession != null) { - return null - } - - val session = browserStore.observeAsComposableState { it.selectedTab?.content }.value - val shouldShowCFR = session != null && session.progress == 100 && !session.loading - - val title = stringResource(R.string.mozac_toolbar_cfr_title) - val description = stringResource(R.string.mozac_toolbar_cfr_description) - return remember(shouldShowCFR, title, description) { - if (shouldShowCFR) { - BrowserToolbarCFR( - enabled = shouldShowCFR, - title = title, - description = description, - onShown = { Toolbar.cfrShown.record(NoExtras()) }, - onDismiss = { - settings.hasSeenBrowserToolbarCFR = true - settings.lastCfrShownTimeInMillis = System.currentTimeMillis() - Toolbar.cfrDismissed.record(NoExtras()) - }, - ) - } else { - null - } - } -} diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -2169,14 +2169,6 @@ class Settings( ) /** - * Indicates if the toolbar CFR was displayed to the user. - */ - var hasSeenBrowserToolbarCFR by booleanPreference( - key = appContext.getPreferenceKey(R.string.pref_key_toolbar_cfr), - default = false, - ) - - /** * Get the current mode for how https-only is enabled. */ fun getHttpsOnlyMode(): HttpsOnlyMode { diff --git a/mobile/android/fenix/app/src/main/res/values/preference_keys.xml b/mobile/android/fenix/app/src/main/res/values/preference_keys.xml @@ -176,9 +176,8 @@ <string name="pref_key_app_icon">pref_key_app_icon</string> <string name="pref_key_app_icon_selection_enabled" translatable="false">pref_key_app_icon_selection_enabled</string> - <!-- Cfr --> + <!-- Menu --> <string name="pref_key_menu_cfr" translatable="false">pref_key_menu_cfr</string> - <string name="pref_key_toolbar_cfr" translatable="false">pref_key_toolbar_cfr</string> <!-- Privacy Pop Window --> <string name="pref_key_privacy_pop_window" translatable="false">pref_key_privacy_pop_window</string>