diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index 576a57958..bb437233f 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -480,7 +480,6 @@ abstract class BaseBrowserFragment : toolbar = bottomToolbarContainerView.toolbarContainerView, store = requireComponents.core.store, appStore = requireComponents.appStore, - viewLifecycleOwner = viewLifecycleOwner, bottomToolbarContainerView = bottomToolbarContainerView, sessionId = customTabSessionId, ), diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/navbar/NavbarIntegration.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/navbar/NavbarIntegration.kt index bdeaad456..e7e1ab101 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/navbar/NavbarIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/navbar/NavbarIntegration.kt @@ -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 diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 42baeb3f2..a847f7508 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -476,7 +476,6 @@ class HomeFragment : Fragment() { toolbar = bottomToolbarContainerView.toolbarContainerView, store = requireComponents.core.store, appStore = requireComponents.appStore, - viewLifecycleOwner = viewLifecycleOwner, bottomToolbarContainerView = bottomToolbarContainerView, sessionId = null, ), diff --git a/app/src/test/java/org/mozilla/fenix/components/toolbar/NavbarIntegrationTest.kt b/app/src/test/java/org/mozilla/fenix/components/toolbar/NavbarIntegrationTest.kt index a620417fa..a402cdbfa 100644 --- a/app/src/test/java/org/mozilla/fenix/components/toolbar/NavbarIntegrationTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/toolbar/NavbarIntegrationTest.kt @@ -22,7 +22,6 @@ class NavbarIntegrationTest { toolbar = mockk(), store = mockk(), appStore = mockk(), - viewLifecycleOwner = mockk(), bottomToolbarContainerView = mockk(), sessionId = null, ).apply {