From 86a8fb0743f8eff09f9112c59d1633d0144beeb7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 20 May 2026 13:33:01 +0000 Subject: [PATCH] feat: replace zap button long-press-to-edit with long-press-to-custom The new Tune button inside the zap popup already opens the quick-zap amounts editor, so the long-press shortcut from the zap button itself (and from each chip inside the popup) is now redundant. Drop those gestures and replace them with the custom-amount dialog that used to live behind double-click: - ZapReaction's button: long-press now opens ZapCustomDialog; double-click is gone. - Each chip in the popup: long-press now opens ZapCustomDialog (via a new onCustomAmount callback threaded through the popup overloads). - NestActionBar's zap button wires onCustomAmount to its existing wantsToSetCustomZap state. - ReusableZapButton has no custom-zap dialog, so chip long-press just dismisses the popup there. --- .../ui/components/ReusableZapButton.kt | 3 +++ .../amethyst/ui/note/ReactionsRow.kt | 24 +++++++++++++++---- .../nests/room/screen/NestActionBar.kt | 13 ++++++---- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt index 7e74f2a3fd..9119521101 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ReusableZapButton.kt @@ -170,6 +170,9 @@ fun ReusableZapButton( onChangeAmount = { wantsToZap = null }, + onCustomAmount = { + wantsToZap = null + }, onError = { _, message, user -> scope.launch { zappingProgress = 0f diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index 336f894ecc..8e6d8730ea 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -1242,8 +1242,7 @@ fun ZapReaction( ) } }, - onLongClick = { nav.nav(Route.UpdateZapAmount()) }, - onDoubleClick = { wantsToSetCustomZap = true }, + onLongClick = { wantsToSetCustomZap = true }, ), ) { if (wantsToZap) { @@ -1262,6 +1261,12 @@ fun ZapReaction( nav.nav(Route.UpdateZapAmount()) } }, + onCustomAmount = { + scope.launch { + wantsToZap = false + wantsToSetCustomZap = true + } + }, onError = { _, message, user -> scope.launch { zappingProgress = 0f @@ -1886,6 +1891,7 @@ fun ZapAmountChoicePopup( onZapStarts: () -> Unit, onDismiss: () -> Unit, onChangeAmount: () -> Unit, + onCustomAmount: () -> Unit, onError: (title: String, text: String, user: User?) -> Unit, onProgress: (percent: Float) -> Unit, onPayViaIntent: (ImmutableList) -> Unit, @@ -1894,7 +1900,7 @@ fun ZapAmountChoicePopup( accountViewModel.account.settings.syncedSettings.zaps.zapAmountChoices .collectAsStateWithLifecycle() - ZapAmountChoicePopup(baseNote, zapAmountChoices, accountViewModel, popupYOffset, onZapStarts, onDismiss, onChangeAmount, onError, onProgress, onPayViaIntent) + ZapAmountChoicePopup(baseNote, zapAmountChoices, accountViewModel, popupYOffset, onZapStarts, onDismiss, onChangeAmount, onCustomAmount, onError, onProgress, onPayViaIntent) } @Composable @@ -1906,12 +1912,13 @@ fun ZapAmountChoicePopup( onZapStarts: () -> Unit, onDismiss: () -> Unit, onChangeAmount: () -> Unit, + onCustomAmount: () -> Unit, onError: (title: String, text: String, user: User?) -> Unit, onProgress: (percent: Float) -> Unit, onPayViaIntent: (ImmutableList) -> Unit, ) { val visibilityState = rememberVisibilityState(onDismiss) - ZapAmountChoicePopup(baseNote, zapAmountChoices, accountViewModel, popupYOffset, visibilityState, onZapStarts, onChangeAmount, onError, onProgress, onPayViaIntent) + ZapAmountChoicePopup(baseNote, zapAmountChoices, accountViewModel, popupYOffset, visibilityState, onZapStarts, onChangeAmount, onCustomAmount, onError, onProgress, onPayViaIntent) } @OptIn(ExperimentalFoundationApi::class, ExperimentalLayoutApi::class) @@ -1924,6 +1931,7 @@ fun ZapAmountChoicePopup( visibilityState: MutableTransitionState, onZapStarts: () -> Unit, onChangeAmount: () -> Unit, + onCustomAmount: () -> Unit, onError: (title: String, text: String, user: User?) -> Unit, onProgress: (percent: Float) -> Unit, onPayViaIntent: (ImmutableList) -> Unit, @@ -1960,6 +1968,10 @@ fun ZapAmountChoicePopup( visibilityState.targetState = false }, onChangeAmount = onChangeAmount, + onCustomAmount = { + visibilityState.targetState = false + onCustomAmount() + }, ) } } @@ -1971,6 +1983,7 @@ fun ZapAmountChoicePopupContent( zapAmountChoices: ImmutableList, onZap: (Long) -> Unit, onChangeAmount: () -> Unit, + onCustomAmount: () -> Unit, ) { Box(HalfPadding, contentAlignment = Center) { ElevatedCard( @@ -1988,7 +2001,7 @@ fun ZapAmountChoicePopupContent( ZapAmountChip( amountInSats = amountInSats, onClick = { onZap(amountInSats) }, - onLongClick = onChangeAmount, + onLongClick = onCustomAmount, ) } ClickableBox( @@ -2055,6 +2068,7 @@ fun ZapAmountChoicePopupPreview() { zapAmountChoices = persistentListOf(50L, 100L, 500L, 1_000L, 5_000L, 10_000L, 100_000L), onZap = {}, onChangeAmount = {}, + onCustomAmount = {}, ) } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt index 623c717a85..9e7faafb92 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/nests/room/screen/NestActionBar.kt @@ -437,10 +437,9 @@ private fun EndCluster( * applies the user's configured zap amount choices the same way the * normal note ⚡ button does (single-tap fires the default amount; * multi-choice opens [ZapAmountChoicePopup]; an unconfigured account - * opens [ZapCustomDialog]). Long-press routes to the - * [Route.UpdateZapAmount] settings screen via the activity's - * [BouncingIntentNav] (no-op when the route can't be expressed as a - * `nostr:` URI — same fallback as the chat panel uses). + * opens [ZapCustomDialog]). Inside the multi-choice popup the Tune + * button jumps to the [Route.UpdateZapAmount] settings screen and + * long-press on a chip opens [ZapCustomDialog]. */ @OptIn(ExperimentalUuidApi::class) @Composable @@ -537,6 +536,12 @@ private fun NestZapButton( nav.nav(Route.UpdateZapAmount()) } }, + onCustomAmount = { + scope.launch { + wantsToZap = false + wantsToSetCustomZap = true + } + }, onError = { _, message, user -> scope.launch { zappingProgress = 0f