For #23256: Pass navController instance instead of lambda.

upstream-sync
mcarare 2 years ago committed by mergify[bot]
parent 854b3701e3
commit 0496249fe4

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

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

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

Loading…
Cancel
Save