Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gaba
fenix
Commits
956bf01c
Commit
956bf01c
authored
Apr 23, 2020
by
Arturo Mejia
Browse files
For issue #9493: Reload after cleaning individual site permissions exceptions
parent
6f5f48c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/settings/sitepermissions/Extensions.kt
0 → 100644
View file @
956bf01c
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package
org.mozilla.fenix.settings.sitepermissions
import
androidx.core.net.toUri
import
org.mozilla.fenix.components.Components
/**
* Try to reload a session if a session with the given [origin] it is found.
* @param origin The origin the session to be reloaded.
*/
internal
fun
Components
.
tryReloadTabBy
(
origin
:
String
)
{
val
session
=
core
.
sessionManager
.
all
.
find
{
it
.
url
.
toUri
().
host
==
origin
}
useCases
.
sessionUseCases
.
reload
(
session
)
}
app/src/main/java/org/mozilla/fenix/settings/sitepermissions/SitePermissionsDetailsExceptionsFragment.kt
View file @
956bf01c
...
...
@@ -100,6 +100,7 @@ class SitePermissionsDetailsExceptionsFragment : PreferenceFragmentCompat() {
requireContext
().
components
.
core
.
permissionStorage
.
deleteSitePermissions
(
sitePermissions
)
withContext
(
Main
)
{
requireView
().
findNavController
().
popBackStack
()
requireContext
().
components
.
tryReloadTabBy
(
sitePermissions
.
origin
)
}
}
}
...
...
app/src/main/java/org/mozilla/fenix/settings/sitepermissions/SitePermissionsManageExceptionsPhoneFeatureFragment.kt
View file @
956bf01c
...
...
@@ -19,6 +19,7 @@ import androidx.fragment.app.Fragment
import
androidx.lifecycle.lifecycleScope
import
androidx.navigation.fragment.navArgs
import
kotlinx.coroutines.Dispatchers.IO
import
kotlinx.coroutines.Dispatchers.Main
import
kotlinx.coroutines.launch
import
mozilla.components.feature.sitepermissions.SitePermissions
import
mozilla.components.feature.sitepermissions.SitePermissions.Status.ALLOWED
...
...
@@ -165,6 +166,9 @@ class SitePermissionsManageExceptionsPhoneFeatureFragment : Fragment() {
}
viewLifecycleOwner
.
lifecycleScope
.
launch
(
IO
)
{
requireComponents
.
core
.
permissionStorage
.
updateSitePermissions
(
updatedSitePermissions
)
launch
(
Main
)
{
requireComponents
.
tryReloadTabBy
(
updatedSitePermissions
.
origin
)
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment