For #11442 - Telemetry for tab counter menu.
parent
af64d93832
commit
9e3e95e351
|
@ -186,6 +186,24 @@ events:
|
|||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
tab_counter_menu_action:
|
||||
type: event
|
||||
description:
|
||||
A tab counter menu item was tapped
|
||||
extra_keys:
|
||||
item:
|
||||
description: |
|
||||
A string containing the name of the item the user tapped. These items
|
||||
are:
|
||||
|
||||
New tab, New private tab, Close tab
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/11442
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11533
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
||||
search_shortcuts:
|
||||
selected:
|
||||
|
|
|
@ -548,6 +548,10 @@ private val Event.wrapper: EventWrapper<*>?
|
|||
is Event.SearchWidgetCFRAddWidgetPressed -> EventWrapper<NoExtraKeys>(
|
||||
{ SearchWidgetCfr.addWidgetPressed.record(it) }
|
||||
)
|
||||
is Event.TabCounterMenuItemTapped -> EventWrapper(
|
||||
{ Events.tabCounterMenuAction.record(it) },
|
||||
{ Events.tabCounterMenuActionKeys.valueOf(it) }
|
||||
)
|
||||
|
||||
// Don't record other events in Glean:
|
||||
is Event.AddBookmark -> null
|
||||
|
|
|
@ -431,6 +431,15 @@ sealed class Event {
|
|||
get() = mapOf(Events.browserMenuActionKeys.item to item.toString().toLowerCase(Locale.ROOT))
|
||||
}
|
||||
|
||||
data class TabCounterMenuItemTapped(val item: Item) : Event() {
|
||||
enum class Item {
|
||||
NEW_TAB, NEW_PRIVATE_TAB, CLOSE_TAB
|
||||
}
|
||||
|
||||
override val extras: Map<Events.tabCounterMenuActionKeys, String>?
|
||||
get() = mapOf(Events.tabCounterMenuActionKeys.item to item.toString().toLowerCase(Locale.ROOT))
|
||||
}
|
||||
|
||||
sealed class Search
|
||||
|
||||
internal open val extras: Map<*, String>?
|
||||
|
|
|
@ -16,6 +16,8 @@ import mozilla.components.browser.session.Session
|
|||
import mozilla.components.browser.session.SessionManager
|
||||
import mozilla.components.concept.toolbar.Toolbar
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.sessionsOfType
|
||||
import org.mozilla.fenix.theme.ThemeManager
|
||||
import java.lang.ref.WeakReference
|
||||
|
@ -77,6 +79,7 @@ class TabCounterToolbarButton(
|
|||
|
||||
private fun getTabContextMenu(context: Context): BrowserMenu {
|
||||
val primaryTextColor = ThemeManager.resolveAttribute(R.attr.primaryText, context)
|
||||
val metrics = context.components.analytics.metrics
|
||||
val menuItems = listOf(
|
||||
BrowserMenuImageText(
|
||||
label = context.getString(R.string.close_tab),
|
||||
|
@ -84,6 +87,7 @@ class TabCounterToolbarButton(
|
|||
iconTintColorResource = primaryTextColor,
|
||||
textColorResource = primaryTextColor
|
||||
) {
|
||||
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.CLOSE_TAB))
|
||||
onItemTapped(TabCounterMenuItem.CloseTab)
|
||||
},
|
||||
BrowserMenuDivider(),
|
||||
|
@ -93,6 +97,7 @@ class TabCounterToolbarButton(
|
|||
iconTintColorResource = primaryTextColor,
|
||||
textColorResource = primaryTextColor
|
||||
) {
|
||||
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.NEW_TAB))
|
||||
onItemTapped(TabCounterMenuItem.NewTab(false))
|
||||
},
|
||||
BrowserMenuImageText(
|
||||
|
@ -101,6 +106,7 @@ class TabCounterToolbarButton(
|
|||
iconTintColorResource = primaryTextColor,
|
||||
textColorResource = primaryTextColor
|
||||
) {
|
||||
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.NEW_PRIVATE_TAB))
|
||||
onItemTapped(TabCounterMenuItem.NewTab(true))
|
||||
}
|
||||
)
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue