Bug 1884487 – simplify NavbarIntegration by removing viewLifecycleOwner

fenix/125.0
mike a 2 months ago committed by mergify[bot]
parent ab304c5f9d
commit 1d0cc1ad52

@ -480,7 +480,6 @@ abstract class BaseBrowserFragment :
toolbar = bottomToolbarContainerView.toolbarContainerView,
store = requireComponents.core.store,
appStore = requireComponents.appStore,
viewLifecycleOwner = viewLifecycleOwner,
bottomToolbarContainerView = bottomToolbarContainerView,
sessionId = customTabSessionId,
),

@ -6,7 +6,6 @@ package org.mozilla.fenix.components.toolbar.navbar
import androidx.annotation.VisibleForTesting
import androidx.core.view.isVisible
import androidx.lifecycle.LifecycleOwner
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.distinctUntilChangedBy
@ -26,19 +25,18 @@ class NavbarIntegration(
val toolbar: ScrollableToolbar,
val store: BrowserStore,
val appStore: AppStore,
val viewLifecycleOwner: LifecycleOwner,
val bottomToolbarContainerView: BottomToolbarContainerView,
sessionId: String?,
) : LifecycleAwareFeature {
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
var toolbarController = ToolbarBehaviorController(toolbar, store, sessionId)
var scope: CoroutineScope? = null
private var scope: CoroutineScope? = null
override fun start() {
toolbarController.start()
scope = appStore.flowScoped(viewLifecycleOwner) { flow ->
scope = appStore.flowScoped { flow ->
flow.distinctUntilChangedBy { it.isSearchDialogVisible }
.collect { state ->
bottomToolbarContainerView.composeView.isVisible = !state.isSearchDialogVisible

@ -476,7 +476,6 @@ class HomeFragment : Fragment() {
toolbar = bottomToolbarContainerView.toolbarContainerView,
store = requireComponents.core.store,
appStore = requireComponents.appStore,
viewLifecycleOwner = viewLifecycleOwner,
bottomToolbarContainerView = bottomToolbarContainerView,
sessionId = null,
),

@ -22,7 +22,6 @@ class NavbarIntegrationTest {
toolbar = mockk(),
store = mockk(),
appStore = mockk(),
viewLifecycleOwner = mockk(),
bottomToolbarContainerView = mockk(),
sessionId = null,
).apply {

Loading…
Cancel
Save