2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

For #16485: Tabs tray grid view telemetry (#17442)

* Tabs tray CFR telemetry interactions

* Create CFR events and implementation

* Tests for tab tray controller
This commit is contained in:
Elise Richards 2021-01-25 15:25:56 -06:00 committed by GitHub
parent 023ddcc131
commit f7b7b25213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 13 deletions

View File

@ -2206,6 +2206,36 @@ reader_mode:
- fenix-core@mozilla.com
expires: "2021-08-01"
tabs_tray.cfr:
dismiss:
type: event
description: |
A user dismisses the tabs tray CFR.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/16485
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/17442
- https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-08-01"
go_to_settings:
type: event
description: |
A user selects the CFR option to navigate to settings.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/16485
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/17442
- https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-08-01"
tabs_tray:
opened:
type: event

View File

@ -168,6 +168,7 @@ sealed class Event {
object ContextualHintETPOutsideTap : Event()
object ContextualHintETPInsideTap : Event()
// Tab tray
object TabsTrayOpened : Event()
object TabsTrayClosed : Event()
object OpenedExistingTab : Event()
@ -180,6 +181,8 @@ sealed class Event {
object TabsTraySaveToCollectionPressed : Event()
object TabsTrayShareAllTabsPressed : Event()
object TabsTrayCloseAllTabsPressed : Event()
object TabsTrayCfrDismissed : Event()
object TabsTrayCfrTapped : Event()
object ProgressiveWebAppOpenFromHomescreenTap : Event()
object ProgressiveWebAppInstallAsShortcut : Event()

View File

@ -55,6 +55,7 @@ import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.Tabs
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.GleanMetrics.TabsTrayCfr
import org.mozilla.fenix.GleanMetrics.Tip
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TopSites
@ -659,7 +660,13 @@ private val Event.wrapper: EventWrapper<*>?
is Event.TabsTrayCloseAllTabsPressed -> EventWrapper<NoExtraKeys>(
{ TabsTray.closeAllTabs.record(it) }
)
Event.AutoPlaySettingVisited -> EventWrapper<NoExtraKeys>(
is Event.TabsTrayCfrDismissed -> EventWrapper<NoExtraKeys>(
{ TabsTrayCfr.dismiss.record(it) }
)
is Event.TabsTrayCfrTapped -> EventWrapper<NoExtraKeys>(
{ TabsTrayCfr.goToSettings.record(it) }
)
is Event.AutoPlaySettingVisited -> EventWrapper<NoExtraKeys>(
{ Autoplay.visitedSetting.record(it) }
)
is Event.AutoPlaySettingChanged -> EventWrapper(
@ -692,25 +699,25 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.recentlyClosedTabsOpened.record(it) }
)
Event.MasterPasswordMigrationDisplayed -> EventWrapper<NoExtraKeys>(
is Event.MasterPasswordMigrationDisplayed -> EventWrapper<NoExtraKeys>(
{ MasterPassword.displayed.record(it) }
)
Event.MasterPasswordMigrationSuccess -> EventWrapper<NoExtraKeys>(
is Event.MasterPasswordMigrationSuccess -> EventWrapper<NoExtraKeys>(
{ MasterPassword.migration.record(it) }
)
Event.TabSettingsOpened -> EventWrapper<NoExtraKeys>(
is Event.TabSettingsOpened -> EventWrapper<NoExtraKeys>(
{ Tabs.settingOpened.record(it) }
)
Event.ContextMenuCopyTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.copyTapped.record(it) }
)
Event.ContextMenuSearchTapped -> EventWrapper<NoExtraKeys>(
is Event.ContextMenuSearchTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.searchTapped.record(it) }
)
Event.ContextMenuSelectAllTapped -> EventWrapper<NoExtraKeys>(
is Event.ContextMenuSelectAllTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.selectAllTapped.record(it) }
)
Event.ContextMenuShareTapped -> EventWrapper<NoExtraKeys>(
is Event.ContextMenuShareTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.shareTapped.record(it) }
)

View File

@ -254,5 +254,6 @@ class DefaultTabTrayController(
override fun handleGoToTabsSettingClicked() {
val directions = TabTrayDialogFragmentDirections.actionGlobalTabSettingsFragment()
navController.navigate(directions)
metrics.track(Event.TabsTrayCfrTapped)
}
}

View File

@ -288,7 +288,10 @@ class TabTrayView(
actionText = view.context.getString(R.string.tab_tray_grid_view_banner_positive_button_text),
container = view.infoBanner,
dismissByHiding = true,
dismissAction = { settings.shouldShowGridViewBanner = false }
dismissAction = {
components.analytics.metrics.track(Event.TabsTrayCfrDismissed)
settings.shouldShowGridViewBanner = false
}
) {
interactor.onGoToTabsSettings()
settings.shouldShowGridViewBanner = false

View File

@ -15,6 +15,7 @@ import io.mockk.mockk
import io.mockk.mockkStatic
import io.mockk.slot
import io.mockk.verify
import io.mockk.verifyAll
import io.mockk.verifyOrder
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestCoroutineScope
@ -251,7 +252,7 @@ class DefaultTabTrayControllerTest {
controller.handleSaveToCollectionClicked(setOf(tab))
verify {
verifyAll {
metrics.track(Event.TabsTraySaveToCollectionPressed)
registerCollectionStorageObserver()
showChooseCollectionDialog(listOf(tab2))
@ -279,7 +280,7 @@ class DefaultTabTrayControllerTest {
val tab = Tab("1234", "mozilla.org")
controller.handleDeleteSelectedTabs(setOf(tab))
verify {
verifyAll {
tabsUseCases.removeTabs(listOf(tab.id))
tabTrayFragmentStore.dispatch(TabTrayDialogFragmentAction.ExitMultiSelectMode)
showUndoSnackbarForTabs()
@ -292,19 +293,31 @@ class DefaultTabTrayControllerTest {
coEvery { bookmarksStorage.getBookmarksWithUrl("mozilla.org") } returns listOf()
controller.handleBookmarkSelectedTabs(setOf(tab))
verify {
verifyAll {
tabTrayFragmentStore.dispatch(TabTrayDialogFragmentAction.ExitMultiSelectMode)
showBookmarksSavedSnackbar()
}
}
@Test
fun handleSetUpAutoCloseTabsClicked() {
fun handleRecentlyClosedClicked() {
controller.handleRecentlyClosedClicked()
val directions = TabTrayDialogFragmentDirections.actionGlobalRecentlyClosed()
verifyAll {
navController.navigate(directions)
metrics.track(Event.RecentlyClosedTabsOpened)
}
}
@Test
fun handleGoToTabsSettingClicked() {
controller.handleGoToTabsSettingClicked()
val directions = TabTrayDialogFragmentDirections.actionGlobalTabSettingsFragment()
verify {
verifyAll {
navController.navigate(directions)
metrics.track(Event.TabsTrayCfrTapped)
}
}
}

View File

@ -197,6 +197,8 @@ The following metrics are added to the ping:
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tabs.setting_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tab settings were opened. |[1](https://github.com/mozilla-mobile/fenix/pull/15811#issuecomment-706402952)||2021-08-01 |2 |
| tabs_tray.cfr.dismiss |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user dismisses the tabs tray CFR. |[1](https://github.com/mozilla-mobile/fenix/pull/17442), [2](https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324)||2021-08-01 |2 |
| tabs_tray.cfr.go_to_settings |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user selects the CFR option to navigate to settings. |[1](https://github.com/mozilla-mobile/fenix/pull/17442), [2](https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324)||2021-08-01 |2 |
| tabs_tray.close_all_tabs |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the close all tabs button in the three dot menu within the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tabs_tray.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tabs_tray.closed_existing_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed an existing tab |[1](https://github.com/mozilla-mobile/fenix/pull/12036), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |