From 2f360eb4742b9917fd94ddd077c3e5497dc1be0a Mon Sep 17 00:00:00 2001 From: mcarare Date: Tue, 24 Nov 2020 18:44:56 +0200 Subject: [PATCH] For #15366: Add recently closed tabs metrics. --- .../main/java/org/mozilla/fenix/components/metrics/Event.kt | 2 ++ .../mozilla/fenix/components/metrics/GleanMetricsService.kt | 4 ++++ .../main/java/org/mozilla/fenix/tabtray/TabTrayController.kt | 1 + 3 files changed, 7 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index a60797788324..5f051f6d6f7d 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -187,6 +187,8 @@ sealed class Event { object TabSettingsOpened : Event() + object RecentlyClosedTabsOpened : Event() + // Interaction events with extras data class TopSiteSwipeCarousel(val page: Int) : Event() { diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index fe12a4c8f4c2..80cfc5a58950 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -674,6 +674,10 @@ private val Event.wrapper: EventWrapper<*>? { ProgressiveWebApp.backgroundKeys.valueOf(it) } ) + is Event.RecentlyClosedTabsOpened -> EventWrapper( + { Events.recentlyClosedTabsOpened.record(it) } + ) + Event.MasterPasswordMigrationDisplayed -> EventWrapper( { MasterPassword.displayed.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt index bb3a4f56b464..f6e4ce768410 100644 --- a/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt +++ b/app/src/main/java/org/mozilla/fenix/tabtray/TabTrayController.kt @@ -250,6 +250,7 @@ class DefaultTabTrayController( override fun handleRecentlyClosedClicked() { val directions = TabTrayDialogFragmentDirections.actionGlobalRecentlyClosed() navController.navigate(directions) + metrics.track(Event.RecentlyClosedTabsOpened) } override fun handleGoToTabsSettingClicked() {