|
|
|
@ -18,6 +18,7 @@ import mozilla.components.ui.tabcounter.TabCounterMenu
|
|
|
|
|
import org.mozilla.fenix.FeatureFlags
|
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.browser.BrowserAnimator
|
|
|
|
|
import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions
|
|
|
|
|
import org.mozilla.fenix.browser.BrowserFragmentDirections
|
|
|
|
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
|
|
|
@ -58,6 +59,7 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
private val engineView: EngineView,
|
|
|
|
|
private val homeViewModel: HomeScreenViewModel,
|
|
|
|
|
private val customTabSessionId: String?,
|
|
|
|
|
private val browserAnimator: BrowserAnimator,
|
|
|
|
|
private val onTabCounterClicked: () -> Unit,
|
|
|
|
|
private val onCloseTab: (SessionState) -> Unit
|
|
|
|
|
) : BrowserToolbarController {
|
|
|
|
@ -97,10 +99,18 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
// If we don't, there's a visual flickr as we navigate to Home and then display search
|
|
|
|
|
// results on top it.
|
|
|
|
|
if (FeatureFlags.showHomeBehindSearch && currentSession?.content?.searchTerms.isNullOrBlank()) {
|
|
|
|
|
browserAnimator.captureEngineViewAndDrawStatically {
|
|
|
|
|
navController.navigate(
|
|
|
|
|
BrowserFragmentDirections.actionGlobalHome()
|
|
|
|
|
)
|
|
|
|
|
navController.navigate(
|
|
|
|
|
BrowserFragmentDirections.actionGlobalSearchDialog(
|
|
|
|
|
currentSession?.id
|
|
|
|
|
),
|
|
|
|
|
getToolbarNavOptions(activity)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
navController.navigate(
|
|
|
|
|
BrowserFragmentDirections.actionGlobalSearchDialog(
|
|
|
|
|
currentSession?.id
|
|
|
|
@ -108,6 +118,7 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
getToolbarNavOptions(activity)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun handleTabCounterClick() {
|
|
|
|
|
onTabCounterClicked.invoke()
|
|
|
|
@ -163,10 +174,12 @@ class DefaultBrowserToolbarController(
|
|
|
|
|
override fun handleHomeButtonClick() {
|
|
|
|
|
metrics.track(Event.BrowserToolbarHomeButtonClicked)
|
|
|
|
|
|
|
|
|
|
browserAnimator.captureEngineViewAndDrawStatically {
|
|
|
|
|
navController.navigate(
|
|
|
|
|
BrowserFragmentDirections.actionGlobalHome()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
internal const val TELEMETRY_BROWSER_IDENTIFIER = "browserMenu"
|
|
|
|
|