For #24206: Remove wrapper from context menu metrics.

pull/543/head
mcarare 2 years ago committed by mergify[bot]
parent 120113abff
commit eb82cfef78

@ -703,6 +703,7 @@ context_menu:
open_in_new_tab, open_in_private_tab, open_image_in_new_tab,
save_image, share_link, copy_link, copy_image_location, share_image
```
type: string
bugs:
- https://github.com/mozilla-mobile/fenix/issues/957
- https://github.com/mozilla-mobile/fenix/issues/16076

@ -5,7 +5,6 @@
package org.mozilla.fenix.components.metrics
import org.mozilla.fenix.GleanMetrics.Autoplay
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.SearchTerms
import java.util.Locale
@ -104,27 +103,6 @@ sealed class Event {
get() = keyName
}
class ContextMenuItemTapped private constructor(val item: String) : Event() {
override val extras: Map<ContextMenu.itemTappedKeys, String>?
get() = mapOf(ContextMenu.itemTappedKeys.named to item)
companion object {
fun create(context_item: String) =
allowList[context_item]?.let { ContextMenuItemTapped(it) }
private val allowList = mapOf(
"mozac.feature.contextmenu.open_in_new_tab" to "open_in_new_tab",
"mozac.feature.contextmenu.open_in_private_tab" to "open_in_private_tab",
"mozac.feature.contextmenu.open_image_in_new_tab" to "open_image_in_new_tab",
"mozac.feature.contextmenu.save_image" to "save_image",
"mozac.feature.contextmenu.share_link" to "share_link",
"mozac.feature.contextmenu.copy_link" to "copy_link",
"mozac.feature.contextmenu.copy_image_location" to "copy_image_location",
"mozac.feature.contextmenu.share_image" to "share_image"
)
}
}
object AutoPlaySettingVisited : Event()
data class AutoPlaySettingChanged(val setting: AutoplaySetting) : Event() {

@ -12,7 +12,6 @@ import org.mozilla.fenix.GleanMetrics.AndroidAutofill
import org.mozilla.fenix.GleanMetrics.Autoplay
import org.mozilla.fenix.GleanMetrics.Awesomebar
import org.mozilla.fenix.GleanMetrics.BrowserSearch
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.ContextualMenu
import org.mozilla.fenix.GleanMetrics.CreditCards
import org.mozilla.fenix.GleanMetrics.HomeMenu
@ -88,10 +87,6 @@ private val Event.wrapper: EventWrapper<*>?
BrowserSearch.inContent[label].add(1)
}
)
is Event.ContextMenuItemTapped -> EventWrapper(
{ ContextMenu.itemTapped.record(it) },
{ ContextMenu.itemTappedKeys.valueOf(it) }
)
is Event.AutoPlaySettingVisited -> EventWrapper<NoExtraKeys>(
{ Autoplay.visitedSetting.record(it) }

@ -36,6 +36,7 @@ import mozilla.components.support.webextensions.facts.WebExtensionFacts
import mozilla.telemetry.glean.private.NoExtras
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.GleanMetrics.Addons
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.LoginDialog
@ -145,6 +146,15 @@ internal class ReleaseMetricController(
CustomTab.closed.record(NoExtras())
}
Component.FEATURE_CONTEXTMENU to ContextMenuFacts.Items.ITEM -> {
metadata?.get("item")?.let {
contextMenuAllowList[item]?.let {
ContextMenu.itemTapped.record(ContextMenu.ItemTappedExtra(it))
}
}
Unit
}
Component.BROWSER_MENU to BrowserMenuFacts.Items.WEB_EXTENSION_MENU_ITEM -> {
metadata?.get("id")?.let {
Addons.openAddonInToolbarMenu.record(Addons.OpenAddonInToolbarMenuExtra(it.toString()))
@ -229,9 +239,6 @@ internal class ReleaseMetricController(
Component.FEATURE_PROMPTS == component && CreditCardAutofillDialogFacts.Items.AUTOFILL_CREDIT_CARD_PROMPT_DISMISSED == item ->
Event.CreditCardAutofillPromptDismissed
Component.FEATURE_CONTEXTMENU == component && ContextMenuFacts.Items.ITEM == item -> {
metadata?.get("item")?.let { Event.ContextMenuItemTapped.create(it.toString()) }
}
Component.FEATURE_CONTEXTMENU == component && ContextMenuFacts.Items.TEXT_SELECTION_OPTION == item -> {
when (metadata?.get("textSelectionOption")?.toString()) {
CONTEXT_MENU_COPY -> Event.ContextMenuCopyTapped
@ -368,5 +375,19 @@ internal class ReleaseMetricController(
const val CONTEXT_MENU_SEARCH_PRIVATELY = "CUSTOM_CONTEXT_MENU_SEARCH_PRIVATELY"
const val CONTEXT_MENU_SELECT_ALL = "org.mozilla.geckoview.SELECT_ALL"
const val CONTEXT_MENU_SHARE = "CUSTOM_CONTEXT_MENU_SHARE"
/**
* Non - Text selection long press context menu items to be tracked.
*/
private val contextMenuAllowList = mapOf(
"mozac.feature.contextmenu.open_in_new_tab" to "open_in_new_tab",
"mozac.feature.contextmenu.open_in_private_tab" to "open_in_private_tab",
"mozac.feature.contextmenu.open_image_in_new_tab" to "open_image_in_new_tab",
"mozac.feature.contextmenu.save_image" to "save_image",
"mozac.feature.contextmenu.share_link" to "share_link",
"mozac.feature.contextmenu.copy_link" to "copy_link",
"mozac.feature.contextmenu.copy_image_location" to "copy_image_location",
"mozac.feature.contextmenu.share_image" to "share_image"
)
}
}

Loading…
Cancel
Save