mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/19970 [Crash] IllegalStateException when navigating to TP panel
This commit is contained in:
parent
24b4a03d32
commit
39ea051a14
@ -39,6 +39,7 @@ import org.mozilla.fenix.ext.nav
|
|||||||
import org.mozilla.fenix.ext.navigateSafe
|
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.ext.runIfFragmentIsAttached
|
||||||
import org.mozilla.fenix.shortcut.PwaOnboardingObserver
|
import org.mozilla.fenix.shortcut.PwaOnboardingObserver
|
||||||
import org.mozilla.fenix.theme.ThemeManager
|
import org.mozilla.fenix.theme.ThemeManager
|
||||||
import org.mozilla.fenix.trackingprotection.TrackingProtectionOverlay
|
import org.mozilla.fenix.trackingprotection.TrackingProtectionOverlay
|
||||||
@ -256,17 +257,18 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
|
|||||||
|
|
||||||
override fun navToTrackingProtectionPanel(tab: SessionState) {
|
override fun navToTrackingProtectionPanel(tab: SessionState) {
|
||||||
val navController = findNavController()
|
val navController = findNavController()
|
||||||
|
|
||||||
requireComponents.useCases.trackingProtectionUseCases.containsException(tab.id) { contains ->
|
requireComponents.useCases.trackingProtectionUseCases.containsException(tab.id) { contains ->
|
||||||
val isEnabled = tab.trackingProtection.enabled && !contains
|
runIfFragmentIsAttached {
|
||||||
val directions =
|
val isEnabled = tab.trackingProtection.enabled && !contains
|
||||||
BrowserFragmentDirections.actionBrowserFragmentToTrackingProtectionPanelDialogFragment(
|
val directions =
|
||||||
sessionId = tab.id,
|
BrowserFragmentDirections.actionBrowserFragmentToTrackingProtectionPanelDialogFragment(
|
||||||
url = tab.content.url,
|
sessionId = tab.id,
|
||||||
trackingProtectionEnabled = isEnabled,
|
url = tab.content.url,
|
||||||
gravity = getAppropriateLayoutGravity()
|
trackingProtectionEnabled = isEnabled,
|
||||||
)
|
gravity = getAppropriateLayoutGravity()
|
||||||
navController.navigateSafe(R.id.browserFragment, directions)
|
)
|
||||||
|
navController.navigateSafe(R.id.browserFragment, directions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ class BrowserToolbarView(
|
|||||||
setToolbarBehavior()
|
setToolbarBehavior()
|
||||||
|
|
||||||
elevation = resources.getDimension(R.dimen.browser_fragment_toolbar_elevation)
|
elevation = resources.getDimension(R.dimen.browser_fragment_toolbar_elevation)
|
||||||
|
|
||||||
if (!isCustomTabSession) {
|
if (!isCustomTabSession) {
|
||||||
display.setUrlBackground(getDrawable(R.drawable.search_url_background))
|
display.setUrlBackground(getDrawable(R.drawable.search_url_background))
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import org.mozilla.fenix.ext.components
|
|||||||
import org.mozilla.fenix.ext.nav
|
import org.mozilla.fenix.ext.nav
|
||||||
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.ext.runIfFragmentIsAttached
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment used for browsing the web within external apps.
|
* Fragment used for browsing the web within external apps.
|
||||||
@ -193,16 +194,18 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
|
|||||||
|
|
||||||
override fun navToTrackingProtectionPanel(tab: SessionState) {
|
override fun navToTrackingProtectionPanel(tab: SessionState) {
|
||||||
requireComponents.useCases.trackingProtectionUseCases.containsException(tab.id) { contains ->
|
requireComponents.useCases.trackingProtectionUseCases.containsException(tab.id) { contains ->
|
||||||
val isEnabled = tab.trackingProtection.enabled && !contains
|
runIfFragmentIsAttached {
|
||||||
val directions =
|
val isEnabled = tab.trackingProtection.enabled && !contains
|
||||||
ExternalAppBrowserFragmentDirections
|
val directions =
|
||||||
.actionGlobalTrackingProtectionPanelDialogFragment(
|
ExternalAppBrowserFragmentDirections
|
||||||
sessionId = tab.id,
|
.actionGlobalTrackingProtectionPanelDialogFragment(
|
||||||
url = tab.content.url,
|
sessionId = tab.id,
|
||||||
trackingProtectionEnabled = isEnabled,
|
url = tab.content.url,
|
||||||
gravity = getAppropriateLayoutGravity()
|
trackingProtectionEnabled = isEnabled,
|
||||||
)
|
gravity = getAppropriateLayoutGravity()
|
||||||
nav(R.id.externalAppBrowserFragment, directions)
|
)
|
||||||
|
nav(R.id.externalAppBrowserFragment, directions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user