2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-02 03:40:16 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/10408: Check current destination before navigating.

This commit is contained in:
mcarare 2020-05-05 10:51:13 +03:00 committed by Mihai Adrian
parent d3edaab688
commit 2b0219b505
2 changed files with 6 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import org.mozilla.fenix.components.TabCollectionStorage
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.navigateSafe
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.shortcut.FirstTimePwaObserver import org.mozilla.fenix.shortcut.FirstTimePwaObserver
@ -181,6 +182,8 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
} }
override fun navToTrackingProtectionPanel(session: Session) { override fun navToTrackingProtectionPanel(session: Session) {
val navController = findNavController()
val useCase = TrackingProtectionUseCases( val useCase = TrackingProtectionUseCases(
sessionManager = requireComponents.core.sessionManager, sessionManager = requireComponents.core.sessionManager,
engine = requireComponents.core.engine engine = requireComponents.core.engine
@ -194,7 +197,7 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
trackingProtectionEnabled = isEnabled, trackingProtectionEnabled = isEnabled,
gravity = getAppropriateLayoutGravity() gravity = getAppropriateLayoutGravity()
) )
nav(R.id.browserFragment, directions) navController.navigateSafe(R.id.browserFragment, directions)
} }
} }

View File

@ -38,6 +38,7 @@ import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getRootView import org.mozilla.fenix.ext.getRootView
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.navigateSafe
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.home.SharedViewModel import org.mozilla.fenix.home.SharedViewModel
import org.mozilla.fenix.settings.deletebrowsingdata.deleteAndQuit import org.mozilla.fenix.settings.deletebrowsingdata.deleteAndQuit
@ -190,7 +191,7 @@ class DefaultBrowserToolbarController(
} else { } else {
val directions = val directions =
BrowserFragmentDirections.actionBrowserFragmentToCreateShortcutFragment() BrowserFragmentDirections.actionBrowserFragmentToCreateShortcutFragment()
navController.navigate(directions) navController.navigateSafe(R.id.browserFragment, directions)
} }
} }
} }