fix(wallet): replace the chooser in the back stack when user picks a type

Bug: after saving an NWC connection (or any conclusion of the form
screen), nav.popBack() landed on the wallet-type chooser instead of
the Wallet screen. The chooser would then sit there as a useless dead
end requiring another back press to escape.

Same bug existed on the Cashu add path from the chooser, though the
edit-from-CashuWalletScreen path was unaffected because it bypassed
the chooser entirely.

Fix: at the chooser, replace the chooser entry with the form via
popUpTo(target, Route.WalletAdd::class) instead of pushing the form
on top via nav.nav(target). Now:

  * From + on Wallet → Choose → NWC → Save → back to Wallet (1 pop)
  * From + on Wallet → Choose → Cashu → Save → back to Wallet (1 pop)
  * From CashuWalletScreen → Edit → Save → back to CashuWallet (unchanged)
  * Back button from inside the form now also goes directly to
    Wallet, skipping the chooser that's no longer in the stack —
    a minor improvement since the chooser had nothing useful to
    return to after a type was picked.
This commit is contained in:
Claude
2026-05-27 15:17:42 +00:00
parent 817227806b
commit 9cfca5272e
@@ -92,13 +92,18 @@ fun AddWalletScreen(
icon = MaterialSymbols.Bolt,
title = stringRes(R.string.wallet_add_nwc_title),
description = stringRes(R.string.wallet_add_nwc_description),
onClick = { nav.nav(Route.WalletAddNwc) },
// Replace the chooser in the back stack rather than stacking
// the form on top: once the user picks a wallet type, the
// chooser has done its job. Without this, completing the
// add-wallet form pops back to the chooser, which is a
// pointless dead end.
onClick = { nav.popUpTo(Route.WalletAddNwc, Route.WalletAdd::class) },
)
WalletTypeCard(
icon = MaterialSymbols.AccountBalanceWallet,
title = stringRes(R.string.wallet_add_cashu_title),
description = stringRes(R.string.wallet_add_cashu_description),
onClick = { nav.nav(Route.WalletAddCashu) },
onClick = { nav.popUpTo(Route.WalletAddCashu, Route.WalletAdd::class) },
)
}
}