2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

[fenix] Followup for https://github.com/mozilla-mobile/fenix/issues/11442 - Add tab counter menu metrics to home fragment.

This commit is contained in:
person808 2020-06-22 12:07:55 -07:00 committed by Jeff Boek
parent 4350ff4b25
commit 1aaf9108c7

View File

@ -627,11 +627,13 @@ class HomeFragment : Fragment() {
val isPrivate = (activity as HomeActivity).browsingModeManager.mode == BrowsingMode.Private val isPrivate = (activity as HomeActivity).browsingModeManager.mode == BrowsingMode.Private
val menuItems = listOf( val menuItems = listOf(
BrowserMenuImageText( BrowserMenuImageText(
label = context.getString(if (isPrivate) { label = context.getString(
R.string.browser_menu_new_tab if (isPrivate) {
} else { R.string.browser_menu_new_tab
R.string.home_screen_shortcut_open_new_private_tab_2 } else {
}), R.string.home_screen_shortcut_open_new_private_tab_2
}
),
imageResource = if (isPrivate) { imageResource = if (isPrivate) {
R.drawable.ic_new R.drawable.ic_new
} else { } else {
@ -640,6 +642,15 @@ class HomeFragment : Fragment() {
iconTintColorResource = primaryTextColor, iconTintColorResource = primaryTextColor,
textColorResource = primaryTextColor textColorResource = primaryTextColor
) { ) {
requireComponents.analytics.metrics.track(
Event.TabCounterMenuItemTapped(
if (isPrivate) {
Event.TabCounterMenuItemTapped.Item.NEW_TAB
} else {
Event.TabCounterMenuItemTapped.Item.NEW_PRIVATE_TAB
}
)
)
(activity as HomeActivity).browsingModeManager.mode = (activity as HomeActivity).browsingModeManager.mode =
BrowsingMode.fromBoolean(!isPrivate) BrowsingMode.fromBoolean(!isPrivate)
} }