mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-11 13:11:01 +00:00
For #15366: Add recently closed tabs metrics from history fragment.
This commit is contained in:
parent
2f360eb474
commit
d233229ce4
@ -15,6 +15,8 @@ import mozilla.components.concept.engine.prompt.ShareData
|
|||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricController
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
interface HistoryController {
|
interface HistoryController {
|
||||||
@ -43,7 +45,8 @@ class DefaultHistoryController(
|
|||||||
private val displayDeleteAll: () -> Unit,
|
private val displayDeleteAll: () -> Unit,
|
||||||
private val invalidateOptionsMenu: () -> Unit,
|
private val invalidateOptionsMenu: () -> Unit,
|
||||||
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit,
|
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit,
|
||||||
private val syncHistory: suspend () -> Unit
|
private val syncHistory: suspend () -> Unit,
|
||||||
|
private val metrics: MetricController
|
||||||
) : HistoryController {
|
) : HistoryController {
|
||||||
override fun handleOpen(item: HistoryItem, mode: BrowsingMode?) {
|
override fun handleOpen(item: HistoryItem, mode: BrowsingMode?) {
|
||||||
openToBrowser(item, mode)
|
openToBrowser(item, mode)
|
||||||
@ -111,5 +114,6 @@ class DefaultHistoryController(
|
|||||||
HistoryFragmentDirections.actionGlobalRecentlyClosed(),
|
HistoryFragmentDirections.actionGlobalRecentlyClosed(),
|
||||||
NavOptions.Builder().setPopUpTo(R.id.recentlyClosedFragment, true).build()
|
NavOptions.Builder().setPopUpTo(R.id.recentlyClosedFragment, true).build()
|
||||||
)
|
)
|
||||||
|
metrics.track(Event.RecentlyClosedTabsOpened)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,8 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
|
|||||||
::displayDeleteAllDialog,
|
::displayDeleteAllDialog,
|
||||||
::invalidateOptionsMenu,
|
::invalidateOptionsMenu,
|
||||||
::deleteHistoryItems,
|
::deleteHistoryItems,
|
||||||
::syncHistory
|
::syncHistory,
|
||||||
|
requireComponents.analytics.metrics
|
||||||
)
|
)
|
||||||
historyInteractor = HistoryInteractor(
|
historyInteractor = HistoryInteractor(
|
||||||
historyController
|
historyController
|
||||||
|
@ -25,6 +25,7 @@ import org.junit.Test
|
|||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricController
|
||||||
import org.mozilla.fenix.ext.directionsEq
|
import org.mozilla.fenix.ext.directionsEq
|
||||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class HistoryControllerTest {
|
|||||||
private val invalidateOptionsMenu: () -> Unit = mockk(relaxed = true)
|
private val invalidateOptionsMenu: () -> Unit = mockk(relaxed = true)
|
||||||
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit = mockk(relaxed = true)
|
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit = mockk(relaxed = true)
|
||||||
private val syncHistory: suspend () -> Unit = mockk(relaxed = true)
|
private val syncHistory: suspend () -> Unit = mockk(relaxed = true)
|
||||||
|
private val metrics: MetricController = mockk(relaxed = true)
|
||||||
private val controller = DefaultHistoryController(
|
private val controller = DefaultHistoryController(
|
||||||
store,
|
store,
|
||||||
navController,
|
navController,
|
||||||
@ -56,7 +58,8 @@ class HistoryControllerTest {
|
|||||||
displayDeleteAll,
|
displayDeleteAll,
|
||||||
invalidateOptionsMenu,
|
invalidateOptionsMenu,
|
||||||
deleteHistoryItems,
|
deleteHistoryItems,
|
||||||
syncHistory
|
syncHistory,
|
||||||
|
metrics
|
||||||
)
|
)
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
Loading…
Reference in New Issue
Block a user