From c6cd2fc95d5fffac1df1ae894e6270fdea413011 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 8 May 2026 08:21:31 +0000 Subject: [PATCH] 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) + } + }, + ) } } }