From 6b3e216ea37f8d60e8cbdb1969c090ef56957ac3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 23:00:06 +0000 Subject: [PATCH] fix: let Save commit a typed-but-unadded Cashu mint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When adding a Cashu wallet, the mint URL typed into the input field was only committed to the mint list when the user pressed the "+" button. The Save button was gated on the list being non-empty, so a user who typed a mint, chose a key option, and tried to Save found the button disabled with no obvious reason — they had to discover the "+" button first. Save now folds a pending mint from the input field into the list, making "+" optional. The button also enables when the input is non-blank. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01VX5wkwXbvoQpadALx1ZVjk --- .../loggedIn/wallet/AddCashuWalletScreen.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/AddCashuWalletScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/AddCashuWalletScreen.kt index db7ca683ed..e8982eebf2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/AddCashuWalletScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/AddCashuWalletScreen.kt @@ -426,16 +426,28 @@ fun AddCashuWalletScreen( Spacer(modifier = Modifier.height(24.dp)) + // A mint typed into the input but not yet committed with the "+" + // button. Folding it into the save makes "+" optional: the user can + // type a mint and hit Save directly instead of being blocked by a + // disabled button with no obvious reason. + val pendingMint = mintInput.trim().trimEnd('/') + Button( onClick = { + val allMints = + if (pendingMint.isNotEmpty() && pendingMint !in mints) { + mints.toList() + pendingMint + } else { + mints.toList() + } viewModel.saveWallet( - mints = mints.toList(), + mints = allMints, keyMode = keyMode, manualPrivkey = manualPrivkey.takeIf { keyMode == CashuWalletViewModel.P2pkKeyMode.Manual }, ) }, enabled = - mints.isNotEmpty() && + (mints.isNotEmpty() || pendingMint.isNotEmpty()) && createState !is CashuWalletCreateState.Saving && (keyMode != CashuWalletViewModel.P2pkKeyMode.Manual || manualPrivkey.isNotBlank()), modifier = Modifier.fillMaxWidth(),