No issue: Only report telemetry when tabs tray is first opened

pull/415/head
Roger Yang 3 years ago committed by mergify[bot]
parent f997b7b40f
commit 740330bc2d

@ -32,6 +32,8 @@ class TabSorter(
private val concatAdapter: ConcatAdapter,
private val store: BrowserStore
) : TabsTray, Observable<TabsTray.Observer> by ObserverRegistry() {
private var shouldReportMetrics: Boolean = true
override fun updateTabs(tabs: Tabs) {
val inactiveTabs = tabs.list.getInactiveTabs(context)
val searchTermTabs = tabs.list.getSearchGroupTabs(context)
@ -41,9 +43,6 @@ class TabSorter(
// Inactive tabs
val selectedInactiveIndex = inactiveTabs.findSelectedIndex(selectedTabId)
concatAdapter.inactiveTabsAdapter.updateTabs((Tabs(inactiveTabs, selectedInactiveIndex)))
if (settings.inactiveTabsAreEnabled) {
metrics.track(Event.TabsTrayHasInactiveTabs(inactiveTabs.size))
}
// Tab groups
// We don't need to provide a selectedId, because the [TabGroupAdapter] has that built-in with support from
@ -55,6 +54,14 @@ class TabSorter(
val totalNormalTabs = (normalTabs + remainderTabs)
val selectedTabIndex = totalNormalTabs.findSelectedIndex(selectedTabId)
concatAdapter.browserAdapter.updateTabs(Tabs(totalNormalTabs, selectedTabIndex))
if (shouldReportMetrics) {
shouldReportMetrics = false
if (settings.inactiveTabsAreEnabled) {
metrics.track(Event.TabsTrayHasInactiveTabs(inactiveTabs.size))
}
}
}
override fun isTabSelected(tabs: Tabs, position: Int): Boolean = false

Loading…
Cancel
Save