Add advanced setting to revoke all trusted unknown extensions

This commit is contained in:
arkon 2024-01-07 16:16:26 -05:00
parent 8033a94ee2
commit 3dc2f9a711
3 changed files with 14 additions and 0 deletions

View File

@ -24,4 +24,8 @@ class TrustExtension(
} }
} }
} }
fun revokeAll() {
preferences.trustedExtensions().delete()
}
} }

View File

@ -24,6 +24,7 @@ import androidx.core.net.toUri
import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.base.BasePreferences
import eu.kanade.domain.source.interactor.TrustExtension
import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen
import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen
@ -340,6 +341,7 @@ object SettingsAdvancedScreen : SearchableSettings {
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
val extensionInstallerPref = basePreferences.extensionInstaller() val extensionInstallerPref = basePreferences.extensionInstaller()
var shizukuMissing by rememberSaveable { mutableStateOf(false) } var shizukuMissing by rememberSaveable { mutableStateOf(false) }
val trustExtension = remember { Injekt.get<TrustExtension>() }
if (shizukuMissing) { if (shizukuMissing) {
val dismiss = { shizukuMissing = false } val dismiss = { shizukuMissing = false }
@ -392,6 +394,13 @@ object SettingsAdvancedScreen : SearchableSettings {
} }
}, },
), ),
Preference.PreferenceItem.TextPreference(
title = stringResource(MR.strings.ext_revoke_trust),
onClick = {
trustExtension.revokeAll()
context.toast(MR.strings.requires_app_restart)
},
),
), ),
) )
} }

View File

@ -334,6 +334,7 @@
<string name="ext_installer_private" translatable="false">Private</string> <string name="ext_installer_private" translatable="false">Private</string>
<string name="ext_installer_shizuku_stopped">Shizuku is not running</string> <string name="ext_installer_shizuku_stopped">Shizuku is not running</string>
<string name="ext_installer_shizuku_unavailable_dialog">Install and start Shizuku to use Shizuku as extension installer.</string> <string name="ext_installer_shizuku_unavailable_dialog">Install and start Shizuku to use Shizuku as extension installer.</string>
<string name="ext_revoke_trust">Revoke trusted unknown extensions</string>
<!-- Extension repos --> <!-- Extension repos -->
<string name="label_extension_repos">Extension repos</string> <string name="label_extension_repos">Extension repos</string>