From 0e1dd641d2d3cfc61b1deb54fe0bb340315f03a1 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 17 Apr 2020 23:04:18 +0530 Subject: AutofillDecryptActivity: Show toast on Main dispatcher (#717) Without this the activity will crash rather than display the error Signed-off-by: Harsh Shandilya --- .../pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt index 35b1eee9..ba9431d8 100644 --- a/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/autofill/oreo/ui/AutofillDecryptActivity.kt @@ -212,11 +212,13 @@ class AutofillDecryptActivity : Activity(), CoroutineScope { OpenPgpApi.RESULT_CODE_ERROR -> { val error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR) if (error != null) { - Toast.makeText( - applicationContext, - "Error from OpenKeyChain: ${error.message}", - Toast.LENGTH_LONG - ).show() + withContext(Dispatchers.Main) { + Toast.makeText( + applicationContext, + "Error from OpenKeyChain: ${error.message}", + Toast.LENGTH_LONG + ).show() + } e { "OpenPgpApi ACTION_DECRYPT_VERIFY failed (${error.errorId}): ${error.message}" } } null -- cgit v1.2.3