From 67f5260070d8869cec99095da27b4645879f84b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 7 May 2026 22:53:18 +0000 Subject: [PATCH 1/2] feat(payments): add copy-to-clipboard option in payment targets popup Lets users grab a payment target's address even if no payto:// handler is installed, by adding a second M3ActionRow per target that copies the authority string to the clipboard. --- .../vitorpamplona/amethyst/ui/note/ReactionsRow.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 6bd85b282..3e76b7fb0 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 @@ -82,6 +82,7 @@ import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.platform.LocalClipboard import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.semantics.Role @@ -128,6 +129,7 @@ import com.vitorpamplona.amethyst.ui.components.M3ActionDialog import com.vitorpamplona.amethyst.ui.components.M3ActionRow import com.vitorpamplona.amethyst.ui.components.M3ActionSection import com.vitorpamplona.amethyst.ui.components.toasts.multiline.UserBasedErrorMessage +import com.vitorpamplona.amethyst.ui.components.util.setText import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.Route import com.vitorpamplona.amethyst.ui.navigation.routes.routeReplyTo @@ -346,6 +348,8 @@ fun PayReaction( val authorPubkey = baseNote.author?.pubkeyHex ?: return val address = remember(authorPubkey) { PaymentTargetsEvent.createAddress(authorPubkey) } val context = LocalContext.current + val clipboardManager = LocalClipboard.current + val scope = rememberCoroutineScope() LoadAddressableNote(address, accountViewModel) { note -> val targets = remember(note) { (note?.event as? PaymentTargetsEvent)?.paymentTargets() ?: emptyList() } @@ -395,6 +399,16 @@ fun PayReaction( } }, ) + M3ActionRow( + icon = MaterialSymbols.ContentCopy, + text = stringRes(R.string.copy_to_clipboard), + onClick = { + expanded = false + scope.launch { + clipboardManager.setText(target.authority) + } + }, + ) } } } From c6cd2fc95d5fffac1df1ae894e6270fdea413011 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 8 May 2026 08:21:31 +0000 Subject: [PATCH 2/2] feat(payments): add copy-to-clipboard option in profile payment button Mirrors the option added to the reactions-row payment popup so the address can also be copied from a user's profile header. --- .../loggedIn/profile/header/PaymentButton.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/PaymentButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/PaymentButton.kt index 61b58bddf..41fd8e2d8 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/PaymentButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/PaymentButton.kt @@ -28,8 +28,10 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalClipboard import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.core.net.toUri @@ -40,6 +42,7 @@ import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.ui.components.M3ActionDialog import com.vitorpamplona.amethyst.ui.components.M3ActionRow import com.vitorpamplona.amethyst.ui.components.M3ActionSection +import com.vitorpamplona.amethyst.ui.components.util.setText import com.vitorpamplona.amethyst.ui.note.ErrorMessageDialog import com.vitorpamplona.amethyst.ui.note.LoadAddressableNote import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -47,6 +50,7 @@ import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.ZeroPadding import com.vitorpamplona.quartz.experimental.nipA3.PaymentTarget import com.vitorpamplona.quartz.experimental.nipA3.PaymentTargetsEvent +import kotlinx.coroutines.launch @Composable fun PaymentButton( @@ -72,6 +76,8 @@ fun PaymentButton( @Composable fun PaymentButtonWithTargets(targets: List) { val context = LocalContext.current + val clipboardManager = LocalClipboard.current + val scope = rememberCoroutineScope() var expanded by remember { mutableStateOf(false) } var errorMessage by remember { mutableStateOf(null) } @@ -111,6 +117,16 @@ fun PaymentButtonWithTargets(targets: List) { } }, ) + M3ActionRow( + icon = MaterialSymbols.ContentCopy, + text = stringRes(R.string.copy_to_clipboard), + onClick = { + expanded = false + scope.launch { + clipboardManager.setText(target.authority) + } + }, + ) } } }