diff --git a/app/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsScreen.kt b/app/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsScreen.kt
index 6362884f3..911beaafa 100644
--- a/app/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsScreen.kt
+++ b/app/src/main/kotlin/at/bitfire/davdroid/ui/AppSettingsScreen.kt
@@ -425,23 +425,9 @@ fun AppSettings_Security(
var showingDistrustWarning by remember { mutableStateOf(false) }
if (showingDistrustWarning) {
- AlertDialog(
- onDismissRequest = { showingDistrustWarning = false },
- title = { Text(stringResource(R.string.app_settings_distrust_system_certs)) },
- text = { Text(stringResource(R.string.app_settings_distrust_system_certs_warning)) },
- confirmButton = {
- TextButton(
- onClick = {
- onDistrustSystemCertsUpdated(true)
- showingDistrustWarning = false
- }
- ) { Text(stringResource(R.string.dialog_confirm)) }
- },
- dismissButton = {
- TextButton(
- onClick = { showingDistrustWarning = false }
- ) { Text(stringResource(R.string.dialog_deny)) }
- },
+ DistrustSystemCertificatesAlertDialog(
+ onDistrustSystemCertsRequested = { onDistrustSystemCertsUpdated(true) },
+ onDismissRequested = { showingDistrustWarning = false }
)
}
@@ -472,6 +458,39 @@ fun AppSettings_Security(
)
}
+@Composable
+fun DistrustSystemCertificatesAlertDialog(
+ onDistrustSystemCertsRequested: () -> Unit,
+ onDismissRequested: () -> Unit,
+) {
+ AlertDialog(
+ onDismissRequest = onDismissRequested,
+ title = { Text(stringResource(R.string.app_settings_distrust_system_certs_dialog_title)) },
+ text = { Text(stringResource(R.string.app_settings_distrust_system_certs_dialog_message)) },
+ confirmButton = {
+ TextButton(
+ onClick = {
+ onDistrustSystemCertsRequested()
+ onDismissRequested()
+ }
+ ) { Text(stringResource(R.string.dialog_enable)) }
+ },
+ dismissButton = {
+ TextButton(
+ onClick = onDismissRequested
+ ) { Text(stringResource(R.string.dialog_deny)) }
+ },
+ )
+}
+
+@Preview
+@Composable
+fun DistrustSystemCertificatesAlertDialog_Preview() {
+ AppTheme {
+ DistrustSystemCertificatesAlertDialog({}, {})
+ }
+}
+
@Composable
fun AppSettings_UserInterface(
theme: Int,
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 820e559e7..7221a8bea 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -11,7 +11,7 @@
Delete
Remove
Cancel
- Confirm
+ Enable
This field is required
Help
Navigate up
@@ -194,7 +194,8 @@
Distrust system certificates
System and user-added CAs won\'t be trusted
System and user-added CAs will be trusted (recommended)
- Are you sure that you want to enable distrusting system certificates? When enabled, you need to manually install the certificates required for your connections, or otherwise they won\'t be possible. This option is targeted to users with high knowledge of networking.
+ Attention!
+ Enabling this option will cause DAVx5 to distrust system certificates. You will need to manually install the required certificates. This option is intended for advanced users.
Reset (un)trusted certificates
Resets trust of all custom certificates
All custom certificates have been cleared