From 1aaf9108c7264958659488b85bcc0763d6918226 Mon Sep 17 00:00:00 2001 From: person808 Date: Mon, 22 Jun 2020 12:07:55 -0700 Subject: [PATCH] [fenix] Followup for https://github.com/mozilla-mobile/fenix/issues/11442 - Add tab counter menu metrics to home fragment. --- .../org/mozilla/fenix/home/HomeFragment.kt | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 5967f7ba07..60ea262da8 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -627,11 +627,13 @@ class HomeFragment : Fragment() { val isPrivate = (activity as HomeActivity).browsingModeManager.mode == BrowsingMode.Private val menuItems = listOf( BrowserMenuImageText( - label = context.getString(if (isPrivate) { - R.string.browser_menu_new_tab - } else { - R.string.home_screen_shortcut_open_new_private_tab_2 - }), + label = context.getString( + if (isPrivate) { + R.string.browser_menu_new_tab + } else { + R.string.home_screen_shortcut_open_new_private_tab_2 + } + ), imageResource = if (isPrivate) { R.drawable.ic_new } else { @@ -640,6 +642,15 @@ class HomeFragment : Fragment() { iconTintColorResource = 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 = BrowsingMode.fromBoolean(!isPrivate) }