tor-browser

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

commit 3ce6ac4d28c9c9c43fa32b79b3d2e28669cc95c3
parent e692405da5787b7885238dd70fa07d1772e8c949
Author: Harrison Oglesby <oglesby.harrison@gmail.com>
Date:   Fri, 12 Dec 2025 16:05:43 +0000

Bug 2005537 - Do not show share button in custom tabs toolbar. r=android-reviewers,petru

Differential Revision: https://phabricator.services.mozilla.com/D276068

Diffstat:
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTestCompose.kt | 1-
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddleware.kt | 17+++--------------
Mmobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddlewareTest.kt | 13+++----------
3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTestCompose.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/NavigationToolbarTestCompose.kt @@ -992,7 +992,6 @@ class NavigationToolbarTestCompose : TestSetup() { verifyCustomTabToolbarTitleWithComposableToolbar(composeTestRule, customTabPage.title) verifyCustomTabUrlWithComposableToolbar(composeTestRule, customTabPage.url.toString()) verifyCustomTabActionButtonWithComposableToolbar(composeTestRule, customTabActionButton) - verifyCustomTabsShareButtonWithComposableToolbar(composeTestRule) verifyMainMenuComposeButtonWithComposableToolbar(composeTestRule) clickCustomTabCloseButtonWithComposableToolbar(composeTestRule) } diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddleware.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddleware.kt @@ -148,7 +148,7 @@ class CustomTabBrowserToolbarMiddleware( updateStartBrowserActions(context, customTab) updateCurrentPageOrigin(context, customTab) updateEndPageActions(context, customTab) - updateEndBrowserActions(context, customTab) + updateEndBrowserActions(context) observePageLoadUpdates(context) observePageOriginUpdates(context) @@ -380,10 +380,9 @@ class CustomTabBrowserToolbarMiddleware( private fun updateEndBrowserActions( context: MiddlewareContext<BrowserToolbarState, BrowserToolbarAction>, - customTab: CustomTabSessionState?, ) = context.store.dispatch( BrowserActionsEndUpdated( - buildEndBrowserActions(customTab), + buildEndBrowserActions(), ), ) @@ -472,17 +471,7 @@ class CustomTabBrowserToolbarMiddleware( } } - private fun buildEndBrowserActions(customTab: CustomTabSessionState?) = buildList { - if (customTab?.config?.showShareMenuItem == true) { - add( - ActionButtonRes( - drawableResId = iconsR.drawable.mozac_ic_share_android_24, - contentDescription = customtabsR.string.mozac_feature_customtabs_share_link, - onClick = ShareClicked, - ), - ) - } - + private fun buildEndBrowserActions() = buildList { add( ActionButtonRes( drawableResId = iconsR.drawable.mozac_ic_ellipsis_vertical_24, diff --git a/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddlewareTest.kt b/mobile/android/fenix/app/src/test/java/org/mozilla/fenix/components/toolbar/CustomTabBrowserToolbarMiddlewareTest.kt @@ -652,13 +652,8 @@ class CustomTabBrowserToolbarMiddlewareTest { } @Test - fun `GIVEN the custom tab is configured to show a share button WHEN initializing the toolbar THEN show both a share and a menu buttons`() { + fun `GIVEN the custom tab is configured to show a share button WHEN initializing the toolbar THEN show just a menu button`() { every { customTab.config.showShareMenuItem } returns true - val expectedShareButton = ActionButtonRes( - drawableResId = iconsR.drawable.mozac_ic_share_android_24, - contentDescription = customtabsR.string.mozac_feature_customtabs_share_link, - onClick = ShareClicked, - ) val expectedMenuButton = ActionButtonRes( drawableResId = iconsR.drawable.mozac_ic_ellipsis_vertical_24, contentDescription = R.string.content_description_menu, @@ -668,10 +663,8 @@ class CustomTabBrowserToolbarMiddlewareTest { val toolbarStore = buildStore() val toolbarBrowserActions = toolbarStore.state.displayState.browserActionsEnd - assertEquals(2, toolbarBrowserActions.size) - val shareButton = toolbarBrowserActions[0] - val menuButton = toolbarBrowserActions[1] - assertEquals(expectedShareButton, shareButton) + assertEquals(1, toolbarBrowserActions.size) + val menuButton = toolbarBrowserActions[0] assertEquals(expectedMenuButton, menuButton) }