Mark key import dialogs as non-cancellable

This commit is contained in:
Harsh Shandilya 2022-07-17 22:22:12 +05:30
parent 4ed98c9fda
commit e1e5d13a6a
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -82,7 +82,7 @@ class PGPKeyImportActivity : AppCompatActivity() {
.setTitle(getString(R.string.pgp_key_import_succeeded))
.setMessage(getString(R.string.pgp_key_import_succeeded_message, tryGetId(key)))
.setPositiveButton(android.R.string.ok) { _, _ -> finish() }
.setOnCancelListener { finish() }
.setCancelable(false)
.show()
}
is Err<Throwable> -> {
@ -94,14 +94,14 @@ class PGPKeyImportActivity : AppCompatActivity() {
handleImportResult(runCatching { importKey(lastBytes!!, replace = true) })
}
.setNegativeButton(R.string.dialog_no) { _, _ -> finish() }
.setOnCancelListener { finish() }
.setCancelable(false)
.show()
} else {
MaterialAlertDialogBuilder(this)
.setTitle(getString(R.string.pgp_key_import_failed))
.setMessage(result.error.message)
.setPositiveButton(android.R.string.ok) { _, _ -> finish() }
.setOnCancelListener { finish() }
.setCancelable(false)
.show()
}
}