clairehurst pushed to branch tor-browser-148.0a1-16.0-2 at The Tor Project / Applications / Tor Browser
Commits:
-
ac3ffc44
by clairehurst at 2026-03-02T16:22:13-07:00
5 changed files:
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/MenuDialogFragment.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/CustomTabMenu.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MainMenu.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MenuNavigation.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/menu/compose/MoreSettingsSubmenu.kt
Changes:
| ... | ... | @@ -118,6 +118,7 @@ import com.google.android.material.R as materialR |
| 118 | 118 | |
| 119 | 119 | import mozilla.components.browser.engine.gecko.GeckoEngineSession
|
| 120 | 120 | import android.util.Log
|
| 121 | +import org.mozilla.fenix.HomeActivity
|
|
| 121 | 122 | |
| 122 | 123 | // EXPANDED_MIN_RATIO is used for BottomSheetBehavior.halfExpandedRatio().
|
| 123 | 124 | // That value needs to be less than the PEEK_HEIGHT.
|
| ... | ... | @@ -321,7 +322,7 @@ class MenuDialogFragment : BottomSheetDialogFragment() { |
| 321 | 322 | activity?.let { activity ->
|
| 322 | 323 | activity.lifecycleScope.launch {
|
| 323 | 324 | deleteBrowsingDataController.clearBrowsingDataOnQuit {
|
| 324 | - activity.finishAndRemoveTask()
|
|
| 325 | + (activity as HomeActivity).shutDown()
|
|
| 325 | 326 | }
|
| 326 | 327 | }
|
| 327 | 328 | }
|
| ... | ... | @@ -222,20 +222,6 @@ internal fun CustomTabMenu( |
| 222 | 222 | badgeBackgroundColor = badgeBackgroundColor,
|
| 223 | 223 | )
|
| 224 | 224 | }
|
| 225 | - |
|
| 226 | - if (shouldShowExtensionsMenu) {
|
|
| 227 | - ExtensionsMenuItem(
|
|
| 228 | - inCustomTab = true,
|
|
| 229 | - isPrivate = isPrivate,
|
|
| 230 | - isExtensionsProcessDisabled = isExtensionsProcessDisabled,
|
|
| 231 | - isExtensionsExpanded = isExtensionsExpanded,
|
|
| 232 | - isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
|
|
| 233 | - webExtensionMenuCount = webExtensionMenuCount,
|
|
| 234 | - extensionsMenuItemDescription = extensionsMenuDescription,
|
|
| 235 | - onExtensionsMenuClick = onExtensionsMenuClick,
|
|
| 236 | - extensionSubmenu = extensionSubmenu,
|
|
| 237 | - )
|
|
| 238 | - }
|
|
| 239 | 225 | }
|
| 240 | 226 | |
| 241 | 227 | if (!customTabMenuItems.isNullOrEmpty()) {
|
| ... | ... | @@ -243,33 +243,6 @@ fun MainMenu( |
| 243 | 243 | }
|
| 244 | 244 | }
|
| 245 | 245 | |
| 246 | - if (accessPoint == MenuAccessPoint.Home && showBanner) {
|
|
| 247 | - MenuBanner(
|
|
| 248 | - onDismiss = {
|
|
| 249 | - onBannerDismiss()
|
|
| 250 | - },
|
|
| 251 | - onClick = {
|
|
| 252 | - onBannerClick()
|
|
| 253 | - },
|
|
| 254 | - )
|
|
| 255 | - }
|
|
| 256 | - |
|
| 257 | - if (accessPoint == MenuAccessPoint.Home) {
|
|
| 258 | - MenuGroup {
|
|
| 259 | - ExtensionsMenuItem(
|
|
| 260 | - inCustomTab = false,
|
|
| 261 | - isPrivate = isPrivate,
|
|
| 262 | - isExtensionsProcessDisabled = isExtensionsProcessDisabled,
|
|
| 263 | - isExtensionsExpanded = isExtensionsExpanded,
|
|
| 264 | - isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
|
|
| 265 | - webExtensionMenuCount = webExtensionMenuCount,
|
|
| 266 | - extensionsMenuItemDescription = extensionsMenuItemDescription,
|
|
| 267 | - onExtensionsMenuClick = onExtensionsMenuClick,
|
|
| 268 | - extensionSubmenu = extensionSubmenu,
|
|
| 269 | - )
|
|
| 270 | - }
|
|
| 271 | - }
|
|
| 272 | - |
|
| 273 | 246 | if (accessPoint == MenuAccessPoint.Browser) {
|
| 274 | 247 | ToolsAndActionsMenuGroup(
|
| 275 | 248 | isBookmarked = isBookmarked,
|
| ... | ... | @@ -304,45 +277,24 @@ fun MainMenu( |
| 304 | 277 | )
|
| 305 | 278 | |
| 306 | 279 | MenuGroup {
|
| 307 | - MozillaAccountMenuItem(
|
|
| 308 | - account = account,
|
|
| 309 | - accountState = accountState,
|
|
| 310 | - isPrivate = isPrivate,
|
|
| 311 | - onClick = onMozillaAccountButtonClick,
|
|
| 312 | - )
|
|
| 313 | - |
|
| 314 | 280 | MenuItem(
|
| 315 | 281 | label = stringResource(id = R.string.browser_menu_settings),
|
| 316 | 282 | beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_settings_24),
|
| 317 | 283 | onClick = onSettingsButtonClick,
|
| 318 | 284 | )
|
| 319 | - }
|
|
| 320 | - |
|
| 321 | - if (showQuitMenu) {
|
|
| 322 | - QuitMenuGroup(
|
|
| 323 | - onQuitMenuClick = onQuitMenuClick,
|
|
| 285 | + MenuItem(
|
|
| 286 | + label = stringResource(
|
|
| 287 | + id = R.string.browser_menu_delete_browsing_data_on_quit,
|
|
| 288 | + stringResource(id = R.string.app_name),
|
|
| 289 | + ),
|
|
| 290 | + beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_cross_circle_24),
|
|
| 291 | + state = MenuItemState.WARNING,
|
|
| 292 | + onClick = onQuitMenuClick,
|
|
| 324 | 293 | )
|
| 325 | 294 | }
|
| 326 | 295 | }
|
| 327 | 296 | }
|
| 328 | 297 | |
| 329 | -@Composable
|
|
| 330 | -private fun QuitMenuGroup(
|
|
| 331 | - onQuitMenuClick: () -> Unit,
|
|
| 332 | -) {
|
|
| 333 | - MenuGroup {
|
|
| 334 | - MenuItem(
|
|
| 335 | - label = stringResource(
|
|
| 336 | - id = R.string.browser_menu_delete_browsing_data_on_quit,
|
|
| 337 | - stringResource(id = R.string.app_name),
|
|
| 338 | - ),
|
|
| 339 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_cross_circle_fill_24),
|
|
| 340 | - state = MenuItemState.WARNING,
|
|
| 341 | - onClick = onQuitMenuClick,
|
|
| 342 | - )
|
|
| 343 | - }
|
|
| 344 | -}
|
|
| 345 | - |
|
| 346 | 298 | @Suppress("LongParameterList", "LongMethod", "CognitiveComplexMethod")
|
| 347 | 299 | @Composable
|
| 348 | 300 | private fun ToolsAndActionsMenuGroup(
|
| ... | ... | @@ -435,21 +387,9 @@ private fun ToolsAndActionsMenuGroup( |
| 435 | 387 | )
|
| 436 | 388 | }
|
| 437 | 389 | |
| 438 | - ExtensionsMenuItem(
|
|
| 439 | - inCustomTab = false,
|
|
| 440 | - isPrivate = isPrivate,
|
|
| 441 | - isExtensionsProcessDisabled = isExtensionsProcessDisabled,
|
|
| 442 | - isExtensionsExpanded = isExtensionsExpanded,
|
|
| 443 | - isAllWebExtensionsDisabled = isAllWebExtensionsDisabled,
|
|
| 444 | - webExtensionMenuCount = webExtensionMenuCount,
|
|
| 445 | - extensionsMenuItemDescription = extensionsMenuItemDescription,
|
|
| 446 | - onExtensionsMenuClick = onExtensionsMenuClick,
|
|
| 447 | - extensionSubmenu = extensionSubmenu,
|
|
| 448 | - )
|
|
| 449 | - |
|
| 450 | 390 | if (!moreMenuExpanded) {
|
| 451 | 391 | MoreMenuButtonGroup(
|
| 452 | - isMoreMenuHighlighted = isMoreMenuHighlighted,
|
|
| 392 | + isMoreMenuHighlighted = false, // This prevents a dot from incorrectly showing e.g. "open in app" is available, even though we disable it.
|
|
| 453 | 393 | onMoreMenuClick = onMoreMenuClick,
|
| 454 | 394 | )
|
| 455 | 395 | }
|
| ... | ... | @@ -530,33 +470,20 @@ private fun LibraryMenuGroup( |
| 530 | 470 | .semantics {
|
| 531 | 471 | this.collectionInfo = CollectionInfo(
|
| 532 | 472 | rowCount = 1,
|
| 533 | - columnCount = 4,
|
|
| 473 | + columnCount = 2,
|
|
| 534 | 474 | )
|
| 535 | 475 | },
|
| 536 | 476 | horizontalArrangement = Arrangement.SpaceEvenly,
|
| 537 | 477 | verticalAlignment = Alignment.CenterVertically,
|
| 538 | 478 | ) {
|
| 539 | - LibraryMenuItem(
|
|
| 540 | - modifier = Modifier
|
|
| 541 | - .weight(1f)
|
|
| 542 | - .fillMaxHeight(),
|
|
| 543 | - iconRes = iconsR.drawable.mozac_ic_history_24,
|
|
| 544 | - labelRes = R.string.library_history,
|
|
| 545 | - shape = leftShape,
|
|
| 546 | - index = 0,
|
|
| 547 | - onClick = onHistoryMenuClick,
|
|
| 548 | - )
|
|
| 549 | - |
|
| 550 | - Spacer(Modifier.width(spacerWidth))
|
|
| 551 | - |
|
| 552 | 479 | LibraryMenuItem(
|
| 553 | 480 | modifier = Modifier
|
| 554 | 481 | .weight(1f)
|
| 555 | 482 | .fillMaxHeight(),
|
| 556 | 483 | iconRes = iconsR.drawable.mozac_ic_bookmark_tray_fill_24,
|
| 557 | 484 | labelRes = R.string.library_bookmarks,
|
| 558 | - shape = middleShape,
|
|
| 559 | - index = 1,
|
|
| 485 | + shape = leftShape,
|
|
| 486 | + index = 0,
|
|
| 560 | 487 | onClick = onBookmarksMenuClick,
|
| 561 | 488 | )
|
| 562 | 489 | |
| ... | ... | @@ -569,22 +496,9 @@ private fun LibraryMenuGroup( |
| 569 | 496 | isHighlighted = isDownloadHighlighted,
|
| 570 | 497 | iconRes = iconsR.drawable.mozac_ic_download_24,
|
| 571 | 498 | labelRes = R.string.library_downloads,
|
| 572 | - shape = middleShape,
|
|
| 573 | - index = 2,
|
|
| 574 | - onClick = onDownloadsMenuClick,
|
|
| 575 | - )
|
|
| 576 | - |
|
| 577 | - Spacer(Modifier.width(spacerWidth))
|
|
| 578 | - |
|
| 579 | - LibraryMenuItem(
|
|
| 580 | - modifier = Modifier
|
|
| 581 | - .weight(1f)
|
|
| 582 | - .fillMaxHeight(),
|
|
| 583 | - iconRes = iconsR.drawable.mozac_ic_login_24,
|
|
| 584 | - labelRes = R.string.browser_menu_passwords,
|
|
| 585 | 499 | shape = rightShape,
|
| 586 | - index = 3,
|
|
| 587 | - onClick = onPasswordsMenuClick,
|
|
| 500 | + index = 1,
|
|
| 501 | + onClick = onDownloadsMenuClick,
|
|
| 588 | 502 | )
|
| 589 | 503 | }
|
| 590 | 504 | }
|
| ... | ... | @@ -95,14 +95,6 @@ internal fun MenuNavigation( |
| 95 | 95 | onLongClick = { onForwardButtonClick(true) },
|
| 96 | 96 | )
|
| 97 | 97 | |
| 98 | - MenuNavItem(
|
|
| 99 | - modifier = Modifier.weight(1f),
|
|
| 100 | - state = state,
|
|
| 101 | - painter = painterResource(id = iconsR.drawable.mozac_ic_share_android_24),
|
|
| 102 | - label = stringResource(id = R.string.browser_menu_share),
|
|
| 103 | - onClick = onShareButtonClick,
|
|
| 104 | - )
|
|
| 105 | - |
|
| 106 | 98 | if (isSiteLoading) {
|
| 107 | 99 | MenuNavItem(
|
| 108 | 100 | modifier = Modifier.weight(1f),
|
| ... | ... | @@ -49,67 +49,6 @@ internal fun MoreSettingsSubmenu( |
| 49 | 49 | Column(
|
| 50 | 50 | verticalArrangement = Arrangement.spacedBy(2.dp),
|
| 51 | 51 | ) {
|
| 52 | - if (translationInfo.isTranslationSupported) {
|
|
| 53 | - TranslationMenuItem(
|
|
| 54 | - translationInfo = translationInfo,
|
|
| 55 | - isReaderViewActive = isReaderViewActive,
|
|
| 56 | - )
|
|
| 57 | - }
|
|
| 58 | - |
|
| 59 | - if (isWebCompatReporterSupported) {
|
|
| 60 | - MenuItem(
|
|
| 61 | - label = stringResource(id = R.string.browser_menu_webcompat_reporter_2),
|
|
| 62 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_lightbulb_24),
|
|
| 63 | - state = if (isWebCompatEnabled) MenuItemState.ENABLED else MenuItemState.DISABLED,
|
|
| 64 | - onClick = onWebCompatReporterClick,
|
|
| 65 | - )
|
|
| 66 | - }
|
|
| 67 | - |
|
| 68 | - if (showShortcuts) {
|
|
| 69 | - ShortcutsMenuItem(
|
|
| 70 | - isPinned = isPinned,
|
|
| 71 | - onShortcutsMenuClick = onShortcutsMenuClick,
|
|
| 72 | - )
|
|
| 73 | - }
|
|
| 74 | - |
|
| 75 | - if (isAddToHomeScreenSupported) {
|
|
| 76 | - MenuItem(
|
|
| 77 | - label = if (isInstallable) {
|
|
| 78 | - stringResource(id = R.string.browser_menu_add_app_to_homescreen)
|
|
| 79 | - } else {
|
|
| 80 | - stringResource(id = R.string.browser_menu_add_to_homescreen)
|
|
| 81 | - },
|
|
| 82 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_add_to_homescreen_24),
|
|
| 83 | - onClick = onAddToHomeScreenMenuClick,
|
|
| 84 | - )
|
|
| 85 | - }
|
|
| 86 | - |
|
| 87 | - MenuItem(
|
|
| 88 | - label = stringResource(id = R.string.browser_menu_save_to_collection_2),
|
|
| 89 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_collection_24),
|
|
| 90 | - onClick = onSaveToCollectionMenuClick,
|
|
| 91 | - )
|
|
| 92 | - |
|
| 93 | - if (hasExternalApp) {
|
|
| 94 | - MenuItem(
|
|
| 95 | - label = if (externalAppName != "") {
|
|
| 96 | - stringResource(id = R.string.browser_menu_open_in_fenix, externalAppName)
|
|
| 97 | - } else {
|
|
| 98 | - stringResource(id = R.string.browser_menu_open_app_link)
|
|
| 99 | - },
|
|
| 100 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_more_grid_24),
|
|
| 101 | - isBeforeIconHighlighted = isOpenInAppMenuHighlighted,
|
|
| 102 | - state = MenuItemState.ENABLED,
|
|
| 103 | - onClick = onOpenInAppMenuClick,
|
|
| 104 | - )
|
|
| 105 | - } else {
|
|
| 106 | - MenuItem(
|
|
| 107 | - label = stringResource(id = R.string.browser_menu_open_app_link),
|
|
| 108 | - beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_more_grid_24),
|
|
| 109 | - state = MenuItemState.DISABLED,
|
|
| 110 | - )
|
|
| 111 | - }
|
|
| 112 | - |
|
| 113 | 52 | MenuItem(
|
| 114 | 53 | label = stringResource(id = R.string.browser_menu_save_as_pdf_2),
|
| 115 | 54 | beforeIconPainter = painterResource(id = iconsR.drawable.mozac_ic_save_file_24),
|