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 7a4067d6b8..8ffc1fcec7 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 @@ -2067,11 +2067,16 @@ fun ZapAmountChoicePopup( val cashuEntries by cashuState.tokenEntries.collectAsStateWithLifecycle() val recipientInfo = author?.let { observeUserInfo(it, accountViewModel).value } val nutzapInfo = author?.let { observeNoteEvent(it.nutzapInfoNote, accountViewModel).value } + // Honors the user's "show on-chain wallet" preference: off hides the on-chain + // rail from the zap chips too, matching the wallet screen, profile chips, and + // Send Payment screen. + val showOnchainWallet by accountViewModel.settings.uiSettingsFlow.showOnchainWallet + .collectAsStateWithLifecycle() val railCapability = - remember(baseNote, onchainSupported, cashuMints, cashuEntries, recipientInfo, nutzapInfo) { + remember(baseNote, onchainSupported, showOnchainWallet, cashuMints, cashuEntries, recipientInfo, nutzapInfo) { val rc = RailCapabilityResolver.peek(baseNote, cashuState) - if (onchainSupported) rc else rc.copy(hasOnchain = false) + if (onchainSupported && showOnchainWallet) rc else rc.copy(hasOnchain = false) } val amountChoices = remember(zapAmountChoices) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt index 8c29e8e01c..6a62b3c88b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapCustomDialog.kt @@ -71,6 +71,7 @@ import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import androidx.core.net.toUri import androidx.lifecycle.ViewModel +import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account @@ -180,6 +181,11 @@ fun ZapCustomDialog( // payment method, no "go back to Lightning" is offered here. var sendOnchain by remember { mutableStateOf(false) } + // Hides the "Send on-chain instead" hand-off when the user has turned the + // on-chain wallet off, matching every other on-chain surface. + val showOnchainWallet by accountViewModel.settings.uiSettingsFlow.showOnchainWallet + .collectAsStateWithLifecycle() + Dialog( onDismissRequest = { onClose() }, properties = @@ -353,16 +359,18 @@ fun ZapCustomDialog( // Hand off to the on-chain dialog with the entered amount + // message prefilled. Disabled while the amount is empty so the // user can't open a sheet that immediately gates on its own - // empty field. - TextButton( - onClick = { sendOnchain = true }, - enabled = postViewModel.canSend() && !baseNote.isDraft(), - modifier = - Modifier - .fillMaxWidth() - .padding(top = 4.dp), - ) { - Text(text = stringRes(id = R.string.send_onchain_instead)) + // empty field. Hidden entirely when the on-chain wallet is off. + if (showOnchainWallet) { + TextButton( + onClick = { sendOnchain = true }, + enabled = postViewModel.canSend() && !baseNote.isDraft(), + modifier = + Modifier + .fillMaxWidth() + .padding(top = 4.dp), + ) { + Text(text = stringRes(id = R.string.send_onchain_instead)) + } } } }