Add paste button and fix hardcoded string in NewNsecBunkerScreen

Add leading paste icon button to the relay text field for clipboard
pasting, matching the pattern used in the other relay screens. Also
fix the hardcoded "Testing the relay..." loading text to use the
existing string resource.

https://claude.ai/code/session_01PNCVKFSSbD1zSWYhjsoo8S
This commit is contained in:
Claude
2026-03-16 19:29:46 +00:00
parent fe877f3647
commit e6ce597921
@@ -14,6 +14,7 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ContentPaste
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.IconButtonDefaults
@@ -68,6 +69,7 @@ fun NewNsecBunkerScreen(
val secret = remember { mutableStateOf(UUID.randomUUID().toString()) }
var name by remember { mutableStateOf(TextFieldValue(AnnotatedString(""))) }
val context = LocalContext.current
val clipboardManager = LocalClipboard.current
val relays =
remember {
@@ -99,7 +101,7 @@ fun NewNsecBunkerScreen(
if (isLoading.value) {
CenterCircularProgressIndicator(
modifier = Modifier,
text = "Testing the relay...",
text = stringResource(R.string.testing_relay),
)
} else {
Column(
@@ -173,6 +175,23 @@ fun NewNsecBunkerScreen(
label = {
Text(stringResource(R.string.wss))
},
leadingIcon = {
IconButton(
onClick = {
scope.launch {
val text = clipboardManager.getClipEntry()?.clipData?.getItemAt(0)?.text?.toString()
if (!text.isNullOrBlank()) {
textFieldRelay.value = TextFieldValue(text)
}
}
},
) {
Icon(
Icons.Default.ContentPaste,
contentDescription = stringResource(R.string.paste_from_clipboard),
)
}
},
trailingIcon = {
IconButton(
colors = IconButtonDefaults.iconButtonColors().copy(