mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-02 03:40:16 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/19955 https://github.com/mozilla-mobile/fenix/issues/20393: Add telemetry for home screen recent tabs.
This commit is contained in:
parent
b36321a8ed
commit
cc18008cbe
@ -5781,3 +5781,43 @@ start_on_home:
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2022-06-16"
|
||||
recent_tabs:
|
||||
show_all_clicked:
|
||||
type: event
|
||||
description: |
|
||||
User has clicked show all button and opened tabs tray.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/19955
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/20138
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2022-06-23"
|
||||
recent_tab_opened:
|
||||
type: event
|
||||
description: |
|
||||
User has opened a recent tab from homescreen.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/19955
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/20138
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2022-06-23"
|
||||
in_progress_media_tab_opened:
|
||||
type: event
|
||||
description: |
|
||||
User has opened a recent tab from homescreen.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/20393
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/20138
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2022-06-23"
|
||||
|
@ -244,6 +244,11 @@ sealed class Event {
|
||||
object StartOnHomeEnterHomeScreen : Event()
|
||||
object StartOnHomeOpenTabsTray : Event()
|
||||
|
||||
// Recent tabs
|
||||
object ShowAllRecentTabs : Event()
|
||||
object OpenRecentTab : Event()
|
||||
object OpenInProgressMediaTab : Event()
|
||||
|
||||
// Interaction events with extras
|
||||
|
||||
data class TopSiteSwipeCarousel(val page: Int) : Event() {
|
||||
|
@ -46,6 +46,7 @@ import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
|
||||
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut
|
||||
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
|
||||
import org.mozilla.fenix.GleanMetrics.ReaderMode
|
||||
import org.mozilla.fenix.GleanMetrics.RecentTabs
|
||||
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
|
||||
import org.mozilla.fenix.GleanMetrics.SearchSuggestions
|
||||
import org.mozilla.fenix.GleanMetrics.SearchWidget
|
||||
@ -849,6 +850,18 @@ private val Event.wrapper: EventWrapper<*>?
|
||||
{ StartOnHome.openTabsTray.record(it) }
|
||||
)
|
||||
|
||||
is Event.OpenRecentTab -> EventWrapper<NoExtraKeys>(
|
||||
{ RecentTabs.recentTabOpened.record(it) }
|
||||
)
|
||||
|
||||
is Event.OpenInProgressMediaTab -> EventWrapper<NoExtraKeys>(
|
||||
{ RecentTabs.inProgressMediaTabOpened.record(it) }
|
||||
)
|
||||
|
||||
is Event.ShowAllRecentTabs -> EventWrapper<NoExtraKeys>(
|
||||
{ RecentTabs.showAllClicked.record(it) }
|
||||
)
|
||||
|
||||
// Don't record other events in Glean:
|
||||
is Event.AddBookmark -> null
|
||||
is Event.OpenedAppFirstRun -> null
|
||||
|
@ -317,7 +317,9 @@ class HomeFragment : Fragment() {
|
||||
),
|
||||
recentTabController = DefaultRecentTabsController(
|
||||
selectTabUseCase = components.useCases.tabsUseCases.selectTab,
|
||||
navController = findNavController()
|
||||
navController = findNavController(),
|
||||
metrics = requireComponents.analytics.metrics,
|
||||
store = components.core.store
|
||||
),
|
||||
recentBookmarksController = DefaultRecentBookmarksController(
|
||||
activity = activity,
|
||||
|
@ -5,8 +5,12 @@
|
||||
package org.mozilla.fenix.home.recenttabs.controller
|
||||
|
||||
import androidx.navigation.NavController
|
||||
import mozilla.components.browser.state.store.BrowserStore
|
||||
import mozilla.components.feature.tabs.TabsUseCases.SelectTabUseCase
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.metrics.MetricController
|
||||
import org.mozilla.fenix.ext.inProgressMediaTab
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.home.HomeFragmentDirections
|
||||
import org.mozilla.fenix.home.recenttabs.interactor.RecentTabInteractor
|
||||
@ -35,15 +39,25 @@ interface RecentTabController {
|
||||
*/
|
||||
class DefaultRecentTabsController(
|
||||
private val selectTabUseCase: SelectTabUseCase,
|
||||
private val navController: NavController
|
||||
private val navController: NavController,
|
||||
private val metrics: MetricController,
|
||||
private val store: BrowserStore
|
||||
) : RecentTabController {
|
||||
|
||||
override fun handleRecentTabClicked(tabId: String) {
|
||||
|
||||
if (tabId == store.state.inProgressMediaTab?.id) {
|
||||
metrics.track(Event.OpenInProgressMediaTab)
|
||||
} else {
|
||||
metrics.track(Event.OpenRecentTab)
|
||||
}
|
||||
|
||||
selectTabUseCase.invoke(tabId)
|
||||
navController.navigate(R.id.browserFragment)
|
||||
}
|
||||
|
||||
override fun handleRecentTabShowAllClicked() {
|
||||
metrics.track(Event.ShowAllRecentTabs)
|
||||
navController.nav(
|
||||
R.id.homeFragment,
|
||||
HomeFragmentDirections.actionGlobalTabsTrayFragment()
|
||||
|
@ -23,6 +23,8 @@ import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.metrics.MetricController
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class RecentTabControllerTest {
|
||||
@ -34,6 +36,7 @@ class RecentTabControllerTest {
|
||||
|
||||
private val navController: NavController = mockk(relaxed = true)
|
||||
private val selectTabUseCase: TabsUseCases = mockk(relaxed = true)
|
||||
private val metrics: MetricController = mockk(relaxed = true)
|
||||
|
||||
private lateinit var store: BrowserStore
|
||||
private lateinit var controller: RecentTabController
|
||||
@ -45,7 +48,9 @@ class RecentTabControllerTest {
|
||||
)
|
||||
controller = spyk(DefaultRecentTabsController(
|
||||
selectTabUseCase = selectTabUseCase.selectTab,
|
||||
navController = navController
|
||||
navController = navController,
|
||||
metrics = metrics,
|
||||
store = store
|
||||
))
|
||||
|
||||
every { navController.currentDestination } returns mockk {
|
||||
@ -67,6 +72,7 @@ class RecentTabControllerTest {
|
||||
verify {
|
||||
selectTabUseCase.selectTab.invoke(tab.id)
|
||||
navController.navigate(R.id.browserFragment)
|
||||
metrics.track(Event.OpenRecentTab)
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,6 +85,7 @@ class RecentTabControllerTest {
|
||||
match<NavDirections> { it.actionId == R.id.action_global_tabsTrayFragment },
|
||||
null
|
||||
)
|
||||
metrics.track(Event.ShowAllRecentTabs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user