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/23256: Pass navController instance instead of lambda.

This commit is contained in:
mcarare 2022-01-19 14:05:31 +02:00 committed by mergify[bot]
parent 73f65630f8
commit 59beaaa609
3 changed files with 14 additions and 12 deletions

View File

@ -107,7 +107,7 @@ class DefaultQuickSettingsController(
private val quickSettingsStore: QuickSettingsFragmentStore,
private val browserStore: BrowserStore,
private val ioScope: CoroutineScope,
private val navController: () -> NavController,
private val navController: NavController,
@VisibleForTesting
internal val sessionId: String,
@VisibleForTesting
@ -209,7 +209,7 @@ class DefaultQuickSettingsController(
}
override fun handleDetailsClicked() {
navController().popBackStack()
navController.popBackStack()
val state = quickSettingsStore.state.trackingProtectionState
val directions = NavGraphDirections
@ -220,11 +220,11 @@ class DefaultQuickSettingsController(
gravity = context.components.settings.toolbarPosition.androidGravity,
sitePermissions = sitePermissions
)
navController().navigate(directions)
navController.navigate(directions)
}
override fun handleConnectionDetailsClicked() {
navController().popBackStack()
navController.popBackStack()
val state = quickSettingsStore.state.webInfoState
val directions = ConnectionPanelDialogFragmentDirections
@ -237,7 +237,7 @@ class DefaultQuickSettingsController(
gravity = context.components.settings.toolbarPosition.androidGravity,
sitePermissions = sitePermissions
)
navController().navigate(directions)
navController.navigate(directions)
}
override fun handleClearSiteDataClicked(baseDomain: String) {
@ -248,7 +248,7 @@ class DefaultQuickSettingsController(
Engine.BrowsingData.ALL_SITE_DATA,
),
)
navController().popBackStack()
navController.popBackStack()
}
/**
@ -293,6 +293,6 @@ class DefaultQuickSettingsController(
private fun navigateToManagePhoneFeature(phoneFeature: PhoneFeature) {
val directions = QuickSettingsSheetDialogFragmentDirections
.actionGlobalSitePermissionsManagePhoneFeature(phoneFeature)
navController().navigate(directions)
navController.navigate(directions)
}
}

View File

@ -78,6 +78,7 @@ class QuickSettingsSheetDialogFragment : FenixDialogFragment() {
val rootView = inflateRootView(container)
_binding = FragmentQuickSettingsDialogSheetBinding.bind(rootView)
val navController = findNavController()
quickSettingsStore = QuickSettingsFragmentStore.createStore(
context = context,
websiteUrl = args.url,
@ -96,7 +97,7 @@ class QuickSettingsSheetDialogFragment : FenixDialogFragment() {
quickSettingsStore = quickSettingsStore,
browserStore = components.core.store,
ioScope = viewLifecycleOwner.lifecycleScope + Dispatchers.IO,
navController = { findNavController() },
navController = navController,
sessionId = args.sessionId,
sitePermissions = args.sitePermissions,
settings = components.settings,
@ -122,7 +123,8 @@ class QuickSettingsSheetDialogFragment : FenixDialogFragment() {
ioScope = viewLifecycleOwner.lifecycleScope + Dispatchers.IO,
containerView = binding.clearSiteDataLayout,
containerDivider = binding.clearSiteDataDivider,
interactor = interactor
interactor = interactor,
navController = navController
)
return rootView

View File

@ -101,7 +101,7 @@ class DefaultQuickSettingsControllerTest {
browserStore = browserStore,
sessionId = tab.id,
ioScope = coroutinesScope,
navController = { navController },
navController = navController,
sitePermissions = sitePermissions,
settings = appSettings,
permissionStorage = permissionStorage,
@ -180,7 +180,7 @@ class DefaultQuickSettingsControllerTest {
quickSettingsStore = store,
browserStore = BrowserStore(),
ioScope = coroutinesScope,
navController = { navController },
navController = navController,
sessionId = "123",
sitePermissions = null,
settings = appSettings,
@ -419,7 +419,7 @@ class DefaultQuickSettingsControllerTest {
browserStore = browserStore,
sessionId = tab.id,
ioScope = coroutinesScope,
navController = { navController },
navController = navController,
sitePermissions = sitePermissions,
settings = appSettings,
permissionStorage = permissionStorage,