Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Bug 1884487 – simplify NavbarIntegration by removing viewLifecycleOwner
Browse files Browse the repository at this point in the history
  • Loading branch information
mike a authored and mergify[bot] committed Mar 11, 2024
1 parent c443eda commit 4a13a40
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ abstract class BaseBrowserFragment :
toolbar = bottomToolbarContainerView.toolbarContainerView,
store = requireComponents.core.store,
appStore = requireComponents.appStore,
viewLifecycleOwner = viewLifecycleOwner,
bottomToolbarContainerView = bottomToolbarContainerView,
sessionId = customTabSessionId,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ class HomeFragment : Fragment() {
toolbar = bottomToolbarContainerView.toolbarContainerView,
store = requireComponents.core.store,
appStore = requireComponents.appStore,
viewLifecycleOwner = viewLifecycleOwner,
bottomToolbarContainerView = bottomToolbarContainerView,
sessionId = null,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class NavbarIntegrationTest {
toolbar = mockk(),
store = mockk(),
appStore = mockk(),
viewLifecycleOwner = mockk(),
bottomToolbarContainerView = mockk(),
sessionId = null,
).apply {
Expand Down

0 comments on commit 4a13a40

Please sign in to comment.