Skip to content

Commit

Permalink
For mozilla-mobile#24210: Remove wrapper from recently closed tabs op…
Browse files Browse the repository at this point in the history
…ened event.
  • Loading branch information
mcarare committed Apr 6, 2022
1 parent 3f426bf commit da1419f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ sealed class Event {

object SyncedTabOpened : Event()

object RecentlyClosedTabsOpenedOld : Event()
object HaveOpenTabs : Event()
object HaveNoOpenTabs : Event()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,6 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.syncedTabOpened.record(it) }
)

is Event.RecentlyClosedTabsOpenedOld -> EventWrapper<NoExtraKeys>(
{ Events.recentlyClosedTabsOpened.record(it) }
)

is Event.TabSettingsOpened -> EventWrapper<NoExtraKeys>(
{ Tabs.settingOpened.record(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import androidx.navigation.NavController
import androidx.navigation.NavOptions
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import mozilla.components.service.glean.private.NoExtras
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
Expand Down Expand Up @@ -109,6 +111,6 @@ class DefaultHistoryController(
HistoryFragmentDirections.actionGlobalRecentlyClosed(),
NavOptions.Builder().setPopUpTo(R.id.recentlyClosedFragment, true).build()
)
metrics.track(Event.RecentlyClosedTabsOpenedOld)
Events.recentlyClosedTabsOpened.record(NoExtras())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.browser.storage.sync.Tab as SyncTab
import mozilla.components.concept.engine.prompt.ShareData
import mozilla.components.service.fxa.manager.FxaAccountManager
import mozilla.telemetry.glean.private.NoExtras
import mozilla.components.service.glean.private.NoExtras
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.collections.CollectionsDialog
Expand Down Expand Up @@ -145,7 +146,7 @@ class DefaultNavigationInteractor(
navController.navigate(
TabsTrayFragmentDirections.actionGlobalRecentlyClosed()
)
metrics.track(Event.RecentlyClosedTabsOpenedOld)
Events.recentlyClosedTabsOpened.record(NoExtras())
}

override fun onShareTabs(tabs: Collection<TabSessionState>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.junit.Test
import org.junit.rules.RuleChain
import org.junit.runner.RunWith
import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.collections.CollectionsDialog
Expand Down Expand Up @@ -117,8 +118,12 @@ class NavigationInteractorTest {

@Test
fun `onOpenRecentlyClosedClicked calls navigation on DefaultNavigationInteractor`() {
assertFalse(Events.recentlyClosedTabsOpened.testHasValue())

createInteractor().onOpenRecentlyClosedClicked()

verify(exactly = 1) { navController.navigate(TabsTrayFragmentDirections.actionGlobalRecentlyClosed()) }
assertTrue(Events.recentlyClosedTabsOpened.testHasValue())
}

@Test
Expand Down

0 comments on commit da1419f

Please sign in to comment.