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

upstream-sync
Roger Yang 3 years ago committed by mergify[bot]
parent c4278bfbf6
commit b5c15280f7

@ -29,6 +29,7 @@ class TabSorter(
private val concatAdapter: ConcatAdapter,
private val store: BrowserStore
) : TabsTray, Observable<TabsTray.Observer> by ObserverRegistry() {
private var shouldReportMetrics: Boolean = true
private val groupsSet = mutableSetOf<String>()
override fun updateTabs(tabs: Tabs) {
@ -40,9 +41,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
@ -58,6 +56,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