Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #7075: make toolbar visible on navigation or load request changes
Browse files Browse the repository at this point in the history
added `expandToolbarOnNavigation`method which listens to changes in `tab.content.url` and `tab.content.loadRequest` to expand the toolbar and show loading progress.

closes #7075
ryg-git committed May 24, 2022

Verified

This commit was signed with the committer’s verified signature.
mikekasprzak Mike Kasprzak
1 parent 11e2f51 commit 42144fb
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ import mozilla.components.feature.toolbar.ToolbarPresenter
import mozilla.components.lib.state.ext.flowScoped
import mozilla.components.support.base.feature.LifecycleAwareFeature
import mozilla.components.support.ktx.android.view.hideKeyboard
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifAnyChanged
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
import org.mozilla.focus.GleanMetrics.TabCount
import org.mozilla.focus.GleanMetrics.TrackingProtection
@@ -222,6 +223,7 @@ class BrowserToolbarIntegration(
setBrowserActionButtons()
observeEraseCfr()
}
expandToolbarOnNavigation()
observeTrackingProtectionCfr()
}

@@ -275,6 +277,22 @@ class BrowserToolbarIntegration(
}
}

private fun expandToolbarOnNavigation() {
store.flowScoped { flow ->
flow.mapNotNull {
state ->
state.findCustomTabOrSelectedTab(customTabId)
}
.ifAnyChanged {
tab ->
arrayOf(tab.content.url, tab.content.loadRequest)
}
.collect {
toolbar.expand()
}
}
}

private fun onDismissTrackingProtectionCfr() {
fragment.components?.appStore?.dispatch(AppAction.ShowTrackingProtectionCfrChange(false))
fragment.requireContext().settings.shouldShowCfrForTrackingProtection = false

0 comments on commit 42144fb

Please sign in to comment.