Skip to content

Commit

Permalink
For mozilla-mobile#24210: Remove wrapper from home button clicked event.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed Mar 31, 2022
1 parent 34635f9 commit f8adcb1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ sealed class Event {
object HomeScreenViewCount : Event()
object HomeScreenCustomizedHomeClicked : Event()

// Browser Toolbar
object BrowserToolbarHomeButtonClicked : Event()

// Start on Home
object StartOnHomeEnterHomeScreen : Event()
object StartOnHomeOpenTabsTray : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,6 @@ private val Event.wrapper: EventWrapper<*>?
{ HomeScreen.customizeHomeClicked.record(it) }
)

is Event.BrowserToolbarHomeButtonClicked -> EventWrapper<NoExtraKeys>(
{ Events.browserToolbarHomeTapped.record(it) }
)

is Event.StartOnHomeEnterHomeScreen -> EventWrapper<NoExtraKeys>(
{ StartOnHome.enterHomeScreen.record(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import mozilla.components.browser.state.state.SessionState
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.concept.engine.EngineView
import mozilla.components.feature.tabs.TabsUseCases
import mozilla.components.service.glean.private.NoExtras
import mozilla.components.support.ktx.kotlin.isUrl
import mozilla.components.ui.tabcounter.TabCounterMenu
import org.mozilla.fenix.GleanMetrics.Events
Expand Down Expand Up @@ -172,8 +173,7 @@ class DefaultBrowserToolbarController(
}

override fun handleHomeButtonClick() {
metrics.track(Event.BrowserToolbarHomeButtonClicked)

Events.browserToolbarHomeTapped.record(NoExtras())
browserAnimator.captureEngineViewAndDrawStatically {
navController.navigate(
BrowserFragmentDirections.actionGlobalHome()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import org.mozilla.fenix.browser.BrowserFragmentDirections
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.browser.browsingmode.SimpleBrowsingModeManager
import org.mozilla.fenix.browser.readermode.ReaderModeController
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
Expand Down Expand Up @@ -351,11 +350,13 @@ class DefaultBrowserToolbarControllerTest {

@Test
fun handleHomeButtonClick() {
assertFalse(Events.browserToolbarHomeTapped.testHasValue())

val controller = createController()
controller.handleHomeButtonClick()

verify { navController.navigate(BrowserFragmentDirections.actionGlobalHome()) }
verify { metrics.track(Event.BrowserToolbarHomeButtonClicked) }
assertTrue(Events.browserToolbarHomeTapped.testHasValue())
}

private fun createController(
Expand Down

0 comments on commit f8adcb1

Please sign in to comment.