From ba111dabaac859cc10c8aa307e105a85c5f35ee0 Mon Sep 17 00:00:00 2001 From: Elise Richards Date: Thu, 8 Apr 2021 12:14:28 -0500 Subject: [PATCH] PWA install to homescreen is available in main menu (#18850) --- .../components/toolbar/DefaultToolbarMenu.kt | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt index 5f926f3e4e..8c25d9bfdc 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt @@ -199,6 +199,21 @@ open class DefaultToolbarMenu( } ?: false // End of predicates // + val installToHomescreen = BrowserMenuHighlightableItem( + label = context.getString(R.string.browser_menu_install_on_homescreen), + startImageResource = R.drawable.ic_add_to_homescreen, + iconTintColorResource = primaryTextColor, + highlight = BrowserMenuHighlight.LowPriority( + label = context.getString(R.string.browser_menu_install_on_homescreen), + notificationTint = getColor(context, R.color.whats_new_notification_color) + ), + isHighlighted = { + !context.settings().installPwaOpened + } + ) { + onItemTapped.invoke(ToolbarMenu.Item.InstallToHomeScreen) + } + private val oldCoreMenuItems by lazy { val settings = BrowserMenuHighlightableItem( label = context.getString(R.string.browser_menu_settings), @@ -253,21 +268,6 @@ open class DefaultToolbarMenu( onItemTapped.invoke(ToolbarMenu.Item.SyncedTabs) } - val installToHomescreen = BrowserMenuHighlightableItem( - label = context.getString(R.string.browser_menu_install_on_homescreen), - startImageResource = R.drawable.ic_add_to_homescreen, - iconTintColorResource = primaryTextColor, - highlight = BrowserMenuHighlight.LowPriority( - label = context.getString(R.string.browser_menu_install_on_homescreen), - notificationTint = getColor(context, R.color.whats_new_notification_color) - ), - isHighlighted = { - !context.settings().installPwaOpened - } - ) { - onItemTapped.invoke(ToolbarMenu.Item.InstallToHomeScreen) - } - val findInPage = BrowserMenuImageText( label = context.getString(R.string.browser_menu_find_in_page), imageResource = R.drawable.mozac_ic_search, @@ -541,6 +541,7 @@ open class DefaultToolbarMenu( reportSiteIssuePlaceholder, BrowserMenuDivider(), addToHomeScreenItem.apply { visible = ::canAddToHomescreen }, + installToHomescreen.apply { visible = ::canInstall }, addToTopSitesItem, saveToCollectionItem, BrowserMenuDivider(),