2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/24836 - Remove Event.wrapper for RecentlyVisitedHomepage telemetry

This commit is contained in:
Alexandru2909 2022-04-18 10:50:36 +03:00 committed by mergify[bot]
parent 1e918950c2
commit ae0542a0b6
5 changed files with 4 additions and 30 deletions

View File

@ -6,10 +6,6 @@ package org.mozilla.fenix.components.metrics
sealed class Event {
// Interaction Events
object HistoryHighlightOpened : Event()
object HistorySearchGroupOpened : Event()
// Interaction events with extras
data class SearchWithAds(val providerName: String) : Event() {

View File

@ -10,7 +10,6 @@ import mozilla.components.service.glean.private.NoExtraKeys
import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.GleanMetrics.BrowserSearch
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.RecentlyVisitedHomepage
import org.mozilla.fenix.ext.components
private class EventWrapper<T : Enum<T>>(
@ -71,13 +70,6 @@ private val Event.wrapper: EventWrapper<*>?
BrowserSearch.inContent[label].add(1)
}
)
is Event.HistoryHighlightOpened -> EventWrapper<NoExtraKeys>(
{ RecentlyVisitedHomepage.historyHighlightOpened.record() }
)
is Event.HistorySearchGroupOpened -> EventWrapper<NoExtraKeys>(
{ RecentlyVisitedHomepage.searchGroupOpened.record() }
)
}
/**

View File

@ -10,11 +10,11 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.LifecycleOwner
import mozilla.components.lib.state.ext.observeAsComposableState
import mozilla.components.service.glean.private.NoExtras
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.RecentlyVisitedHomepage
import org.mozilla.fenix.R
import org.mozilla.fenix.components.components
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.compose.ComposeViewHolder
import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem
import org.mozilla.fenix.home.recentvisits.RecentlyVisitedItem.RecentHistoryGroup
@ -26,13 +26,11 @@ import org.mozilla.fenix.home.recentvisits.interactor.RecentVisitsInteractor
*
* @param composeView [ComposeView] which will be populated with Jetpack Compose UI content.
* @property interactor [RecentVisitsInteractor] which will have delegated to all user interactions.
* @property metrics [MetricController] that handles telemetry events.
*/
class RecentlyVisitedViewHolder(
composeView: ComposeView,
viewLifecycleOwner: LifecycleOwner,
private val interactor: RecentVisitsInteractor,
private val metrics: MetricController
) : ComposeViewHolder(composeView, viewLifecycleOwner) {
init {
@ -64,11 +62,11 @@ class RecentlyVisitedViewHolder(
onRecentVisitClick = { recentlyVisitedItem, pageNumber ->
when (recentlyVisitedItem) {
is RecentHistoryHighlight -> {
metrics.track(Event.HistoryHighlightOpened)
RecentlyVisitedHomepage.historyHighlightOpened.record(NoExtras())
interactor.onRecentHistoryHighlightClicked(recentlyVisitedItem)
}
is RecentHistoryGroup -> {
metrics.track(Event.HistorySearchGroupOpened)
RecentlyVisitedHomepage.searchGroupOpened.record(NoExtras())
History.recentSearchesTapped.record(
History.RecentSearchesTappedExtra(
pageNumber.toString()

View File

@ -252,7 +252,6 @@ class SessionControlAdapter(
composeView = ComposeView(parent.context),
viewLifecycleOwner = viewLifecycleOwner,
interactor = interactor,
metrics = components.analytics.metrics
)
RecentVisitsHeaderViewHolder.LAYOUT_ID -> return RecentVisitsHeaderViewHolder(
composeView = ComposeView(parent.context),

View File

@ -12,7 +12,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.GleanMetrics.RecentlyVisitedHomepage
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
@RunWith(FenixRobolectricTestRunner::class)
@ -27,14 +26,4 @@ class GleanMetricsServiceTest {
gleanService = GleanMetricsService(testContext)
}
@Test
fun `Home screen recently visited events are correctly recorded`() {
assertFalse(RecentlyVisitedHomepage.historyHighlightOpened.testHasValue())
gleanService.track(Event.HistoryHighlightOpened)
assertTrue(RecentlyVisitedHomepage.historyHighlightOpened.testHasValue())
assertFalse(RecentlyVisitedHomepage.searchGroupOpened.testHasValue())
gleanService.track(Event.HistorySearchGroupOpened)
assertTrue(RecentlyVisitedHomepage.searchGroupOpened.testHasValue())
}
}