feat: Confirmation before revoke all trusted extensions

This commit is contained in:
ziro 2024-01-24 13:17:42 +07:00
parent 1b9d0bc76f
commit 7d7e2433c7
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 12 additions and 6 deletions

View file

@ -63,7 +63,7 @@ fun ExtensionRepoScreen(
containerColor = MaterialTheme.colorScheme.surface,
title = {
Text(
text = stringResource(R.string.notice_delete_repo_title),
text = stringResource(R.string.confirm_delete_repo_title),
fontStyle = MaterialTheme.typography.titleMedium.fontStyle,
color = MaterialTheme.colorScheme.onSurface,
fontSize = 24.sp,
@ -71,7 +71,7 @@ fun ExtensionRepoScreen(
},
text = {
Text(
text = stringResource(R.string.notice_delete_repo, repoToDelete.orEmpty()),
text = stringResource(R.string.confirm_delete_repo, repoToDelete.orEmpty()),
fontStyle = MaterialTheme.typography.bodyMedium.fontStyle,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontSize = 14.sp,

View file

@ -376,8 +376,13 @@ class SettingsAdvancedController : SettingsController() {
titleRes = R.string.action_revoke_all_extensions
onClick {
trustExtension.revokeAll()
activity?.toast(R.string.requires_app_restart)
activity?.materialAlertDialog()
?.setTitle(R.string.confirm_revoke_all_extensions)
?.setPositiveButton(android.R.string.ok) { _, _ ->
trustExtension.revokeAll()
activity?.toast(R.string.requires_app_restart)
}
?.setNegativeButton(android.R.string.cancel, null)?.show()
}
}
}

View file

@ -364,6 +364,7 @@
<item quantity="other">%d extension updates available</item>
</plurals>
<string name="action_revoke_all_extensions">Revoke all trusted extensions</string>
<string name="confirm_revoke_all_extensions">Revoke all trusted extensions?</string>
<!-- Reader -->
<string name="set_as_cover">Set as cover</string>
@ -915,8 +916,8 @@
<string name="action_add_repo">Add repo</string>
<string name="invalid_repo_url">Invalid repo url</string>
<string name="information_empty_repos">You haven\'t added any repos yet.</string>
<string name="notice_delete_repo_title">Delete repo?</string>
<string name="notice_delete_repo">Are you sure you wish to delete the repo \"%s\"?</string>
<string name="confirm_delete_repo_title">Delete repo?</string>
<string name="confirm_delete_repo">Are you sure you wish to delete the repo \"%s\"?</string>
<!-- About section -->
<string name="version">Version</string>