From 6099948605a89930f82352d26cfd2330a71f05b6 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 29 Aug 2023 16:43:45 -0400 Subject: [PATCH] Migrates from Toast Message to a Dialog when Zap fails in the reaction row. --- .../amethyst/ui/note/ReactionsRow.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 8bbf1d157..454aedf00 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -932,6 +932,12 @@ fun ZapReaction( }, onMultipleChoices = { wantsToZap = true + }, + onError = { + scope.launch { + zappingProgress = 0f + showErrorMessageDialog = it + } } ) }, @@ -1020,7 +1026,8 @@ private fun zapClick( scope: CoroutineScope, context: Context, onZappingProgress: (Float) -> Unit, - onMultipleChoices: () -> Unit + onMultipleChoices: () -> Unit, + onError: (String) -> Unit ) { if (accountViewModel.account.zapAmountChoices.isEmpty()) { scope.launch { @@ -1049,14 +1056,7 @@ private fun zapClick( null, "", context, - onError = { - scope.launch { - onZappingProgress(0f) - Toast - .makeText(context, it, Toast.LENGTH_SHORT) - .show() - } - }, + onError = onError, onProgress = { scope.launch(Dispatchers.Main) { onZappingProgress(it)