1
0
Fork 0

Closes #977: Adds telemetry for custom tabs (#1697)

master
Sawyer Blatz 2019-04-17 11:13:48 -07:00 committed by GitHub
parent cb7ad32b62
commit aa117b1ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 2 deletions

View File

@ -380,4 +380,39 @@ search.default_engine:
- https://github.com/mozilla-mobile/fenix/issues/1607
notification_emails:
- fenix-core@mozilla.com
expires: "2019-09-01"
expires: "2019-09-01"
custom_tab:
closed:
type: event
description: >
A user closed the custom tab
bugs:
- 977
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1697
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
action_button:
type: event
description: >
A user pressed the action button provided by the launching app
bugs:
- 977
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1697
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
menu:
type: event
description: >
A user opened the custom tabs menu
bugs:
- 977
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1697
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"

View File

@ -13,6 +13,7 @@ import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
import org.mozilla.fenix.ext.components
@ -106,6 +107,15 @@ private val Event.wrapper
is Event.QuickActionSheetReadTapped -> EventWrapper<NoExtraKeys>(
{ QuickActionSheet.readTapped.record(it) }
)
is Event.CustomTabsMenuOpened -> EventWrapper<NoExtraKeys>(
{ CustomTab.menu.record(it) }
)
is Event.CustomTabsActionTapped -> EventWrapper<NoExtraKeys>(
{ CustomTab.actionButton.record(it) }
)
is Event.CustomTabsClosed -> EventWrapper<NoExtraKeys>(
{ CustomTab.closed.record(it) }
)
// Don't track other events with Glean
else -> null

View File

@ -57,6 +57,9 @@ sealed class Event {
object QuickActionSheetBookmarkTapped : Event()
object QuickActionSheetDownloadTapped : Event()
object QuickActionSheetReadTapped : Event()
object CustomTabsClosed : Event()
object CustomTabsActionTapped : Event()
object CustomTabsMenuOpened : Event()
// Interaction Events
data class SearchBarTapped(val source: Source) : Event() {
@ -168,6 +171,7 @@ sealed class Event {
get() = null
}
@Suppress("ComplexMethod")
private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
Pair(Component.FEATURE_FINDINPAGE, "previous") -> Event.FindInPagePrevious
Pair(Component.FEATURE_FINDINPAGE, "next") -> Event.FindInPageNext
@ -177,6 +181,12 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
metadata?.get("item")?.let { Event.ContextMenuItemTapped.create(it.toString()) }
}
Pair(Component.FEATURE_TOOLBAR, "menu") -> {
metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened }
}
Pair(Component.FEATURE_CUSTOMTABS, "close") -> Event.CustomTabsClosed
Pair(Component.FEATURE_CUSTOMTABS, "action_button") -> Event.CustomTabsActionTapped
else -> null
}

View File

@ -162,7 +162,7 @@ object Deps {
const val espresso_contrib = "com.android.support.test.espresso:espresso-contrib:${Versions.espresso_version}"
const val espresso_core = "com.android.support.test.espresso:espresso-core:${Versions.espresso_core}"
const val espresso_idling_resources = "com.android.support.test.espresso:espresso-idling-resource:${Versions.espresso_version}"
const val orchestrator = "androidx.test:orchestrator:${Versions.orchestrator}"
const val orchestrator = "androidx.test:orchestrator:${Versions.orchestrator}"
const val tools_test_rules = "com.android.support.test:rules:${Versions.tools_test_rules}"
const val tools_test_runner = "com.android.support.test:runner:${Versions.tools_test_runner}"
const val uiautomator = "com.android.support.test.uiautomator:uiautomator-v18:${Versions.uiautomator}"