1
0
Fork 0

Closes #8176 - Adds new string for add to top sites (#8209)

master
Emily Kager 3 years ago committed by GitHub
parent 8a33897f3a
commit 9e4e23eceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/metrics.yaml
  2. 2
      app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt
  3. 4
      app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt
  4. 11
      app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt
  5. 2
      app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarMenu.kt
  6. 4
      app/src/main/res/values/strings.xml
  7. 6
      app/src/test/java/org/mozilla/fenix/components/toolbar/DefaultBrowserToolbarControllerTest.kt
  8. 2
      docs/metrics.md

@ -82,7 +82,7 @@ events:
A string containing the name of the item the user tapped. These items include:
Settings, Library, Help, Desktop Site toggle on/off, Find in Page, New Tab,
Private Tab, Share, Report Site Issue, Back/Forward button, Reload Button, Quit,
Reader Mode On, Reader Mode Off, Open In App, Add to Firefox Home, Add-ons Manager
Reader Mode On, Reader Mode Off, Open In App, Add To Top Sites, Add-ons Manager
bugs:
- https://github.com/mozilla-mobile/fenix/issues/1024
data_reviews:

@ -352,7 +352,7 @@ sealed class Event {
enum class Item {
SETTINGS, LIBRARY, HELP, DESKTOP_VIEW_ON, DESKTOP_VIEW_OFF, FIND_IN_PAGE, NEW_TAB,
NEW_PRIVATE_TAB, SHARE, REPORT_SITE_ISSUE, BACK, FORWARD, RELOAD, STOP, OPEN_IN_FENIX,
SAVE_TO_COLLECTION, ADD_TO_FIREFOX_HOME, ADD_TO_HOMESCREEN, QUIT, READER_MODE_ON,
SAVE_TO_COLLECTION, ADD_TO_TOP_SITES, ADD_TO_HOMESCREEN, QUIT, READER_MODE_ON,
READER_MODE_OFF, OPEN_IN_APP, BOOKMARK, READER_MODE_APPEARANCE, ADDONS_MANAGER
}

@ -141,7 +141,7 @@ class DefaultBrowserToolbarController(
item.isChecked,
currentSession
)
ToolbarMenu.Item.AddToFirefoxHome -> {
ToolbarMenu.Item.AddToTopSites -> {
ioScope.launch {
currentSession?.let {
topSiteStorage.addTopSite(it.title, it.url)
@ -340,7 +340,7 @@ class DefaultBrowserToolbarController(
ToolbarMenu.Item.OpenInFenix -> Event.BrowserMenuItemTapped.Item.OPEN_IN_FENIX
ToolbarMenu.Item.Share -> Event.BrowserMenuItemTapped.Item.SHARE
ToolbarMenu.Item.SaveToCollection -> Event.BrowserMenuItemTapped.Item.SAVE_TO_COLLECTION
ToolbarMenu.Item.AddToFirefoxHome -> Event.BrowserMenuItemTapped.Item.ADD_TO_FIREFOX_HOME
ToolbarMenu.Item.AddToTopSites -> Event.BrowserMenuItemTapped.Item.ADD_TO_TOP_SITES
ToolbarMenu.Item.AddToHomeScreen -> Event.BrowserMenuItemTapped.Item.ADD_TO_HOMESCREEN
ToolbarMenu.Item.Quit -> Event.BrowserMenuItemTapped.Item.QUIT
is ToolbarMenu.Item.ReaderMode ->

@ -150,7 +150,7 @@ class DefaultToolbarMenu(
settings,
library,
desktopMode,
addToFirefoxHome,
addToTopSites,
addToHomescreen.apply { visible = ::shouldShowAddToHomescreen },
addons,
findInPage,
@ -221,15 +221,12 @@ class DefaultToolbarMenu(
onItemTapped.invoke(ToolbarMenu.Item.RequestDesktop(checked))
}
private val addToFirefoxHome = BrowserMenuImageText(
label = context.getString(
R.string.browser_menu_add_to_firefox_home,
context.getString(R.string.app_name)
),
private val addToTopSites = BrowserMenuImageText(
label = context.getString(R.string.browser_menu_add_to_top_sites),
imageResource = R.drawable.ic_home,
iconTintColorResource = primaryTextColor()
) {
onItemTapped.invoke(ToolbarMenu.Item.AddToFirefoxHome)
onItemTapped.invoke(ToolbarMenu.Item.AddToTopSites)
}
private val addToHomescreen = BrowserMenuHighlightableItem(

@ -24,7 +24,7 @@ interface ToolbarMenu {
object ReportIssue : Item()
object OpenInFenix : Item()
object SaveToCollection : Item()
object AddToFirefoxHome : Item()
object AddToTopSites : Item()
object AddToHomeScreen : Item()
object AddonsManager : Item()
object Quit : Item()

@ -78,8 +78,6 @@
<string name="browser_menu_your_library">Your Library</string>
<!-- Browser menu toggle that requests a desktop site -->
<string name="browser_menu_desktop_site">Desktop site</string>
<!-- Browser menu button that adds a top site to the home fragment (for example: Fenix) -->
<string name="browser_menu_add_to_firefox_home">Add to %s home</string>
<!-- Browser menu toggle that adds a shortcut to the site on the device home screen. -->
<string name="browser_menu_add_to_homescreen">Add to Home screen</string>
<!-- Browser menu toggle that installs a Progressive Web App shortcut to the site on the device home screen. -->
@ -1206,6 +1204,8 @@
<string name="pocket_top_articles">Top Articles</string>
<!-- Bookmark deletion confirmation -->
<string name="bookmark_deletion_confirmation">Are you sure you want to delete this bookmark?</string>
<!-- Browser menu button that adds a top site to the home fragment -->
<string name="browser_menu_add_to_top_sites">Add to top sites</string>
<!-- text shown before the issuer name to indicate who its verified by, parameter is the name of
the certificate authority that verified the ticket-->
<string name="certificate_info_verified_by">Verified By: %1$s </string>

@ -295,8 +295,8 @@ class DefaultBrowserToolbarControllerTest {
}
@Test
fun handleToolbarAddToFirefoxHomePress() = runBlockingTest {
val item = ToolbarMenu.Item.AddToFirefoxHome
fun handleToolbarAddToTopSitesPressed() = runBlockingTest {
val item = ToolbarMenu.Item.AddToTopSites
controller = DefaultBrowserToolbarController(
activity = activity,
@ -322,7 +322,7 @@ class DefaultBrowserToolbarControllerTest {
controller.handleToolbarItemInteraction(item)
verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.ADD_TO_FIREFOX_HOME)) }
verify { metrics.track(Event.BrowserMenuItemTapped(Event.BrowserMenuItemTapped.Item.ADD_TO_TOP_SITES)) }
}
@Test

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save