From 023a3c6624ecd1e19e02f350757a97bacd5d5620 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 27 May 2026 13:10:36 +0000 Subject: [PATCH] feat(profile): toast when no app handles a payment target scheme Tapping a chip silently failed if no installed app handled the type-specific URI scheme (bitcoin:, ethereum:, monero:, etc.). Surface that case through the existing toastManager so users know to install a compatible wallet. https://claude.ai/code/session_01R7kRziq14Hc22dPwAnZRAr --- .../profile/header/DisplayPaymentTargets.kt | 14 ++++++++++++-- amethyst/src/main/res/values/strings.xml | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayPaymentTargets.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayPaymentTargets.kt index 97f8fe8857..87cd471059 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayPaymentTargets.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayPaymentTargets.kt @@ -89,7 +89,7 @@ fun DisplayPaymentTargets( verticalArrangement = Arrangement.spacedBy(6.dp), modifier = Modifier.padding(vertical = 4.dp), ) { - targets.forEach { target -> PaymentTargetChip(target) } + targets.forEach { target -> PaymentTargetChip(target, accountViewModel) } } } } @@ -97,7 +97,10 @@ fun DisplayPaymentTargets( } @Composable -private fun PaymentTargetChip(target: PaymentTarget) { +private fun PaymentTargetChip( + target: PaymentTarget, + accountViewModel: AccountViewModel, +) { val style = remember(target.type) { paymentTargetStyleFor(target.type) } val uriHandler = LocalUriHandler.current val context = LocalContext.current @@ -114,6 +117,13 @@ private fun PaymentTargetChip(target: PaymentTarget) { Modifier.combinedClickable( onClick = { runCatching { uriHandler.openUri(style.uriFor(target.authority)) } + .onFailure { + accountViewModel.toastManager.toast( + R.string.error_dialog_payment_error, + R.string.no_payment_app_found_for_type, + style.label, + ) + } }, onLongClick = { scope.launch { diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 487aa62511..d530977bde 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -950,6 +950,7 @@ Address Delete payment target No app found to handle this payment. Please install a compatible wallet. + No app installed to handle %1$s payments. Please install a compatible wallet. Unable to open payment Not Started