commit 3c507b3cbfc265944293e2a166410a1a2553d061
parent c409de639b720c5b487b44fbddc0301de2e25409
Author: Iván Ávalos <avalos@disroot.org>
Date: Sun, 9 Aug 2026 17:46:00 +0200
[wallet] show the payment prompt for a payment wallet-core prepared itself
Diffstat:
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt b/wallet/src/main/java/net/taler/wallet/payment/PaymentManager.kt
@@ -185,15 +185,29 @@ class PaymentManager(
) {
currentTransactionId = transactionId
startNewAttempt {
+ // Fresh payments start at a loading prompt.
+ mPayStatus.value = PayStatus.Loading
when (val response = api.request("getChoicesForPayment", GetChoicesForPaymentResponse.serializer()) {
put("transactionId", transactionId)
}) {
- is WalletResponse.Error -> handleError("getChoicesForPayment", response.error, transactionId)
+ is WalletResponse.Error -> {
+ val error = response.error
+ if (error.code == TalerErrorCode.WALLET_REQUEST_TRANSACTION_STATE_UNSUPPORTED) {
+ // The proposal is not downloaded yet; keep loading until it is.
+ Log.d(TAG, "getChoicesForPayment not ready yet: $error")
+ } else {
+ handleError("getChoicesForPayment", error, transactionId)
+ }
+ }
is WalletResponse.Success -> {
val res = response.result
if (res.automaticExecution == true && res.automaticExecutableIndex != null) {
- confirmPay(transactionId, res.automaticExecutableIndex, automaticExecution = true)
+ confirmPay(
+ transactionId,
+ res.automaticExecutableIndex,
+ automaticExecution = true
+ )
return@startNewAttempt
}
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailScreen.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionDetailScreen.kt
@@ -197,7 +197,11 @@ fun TransactionDetailScreen(
is WalletDestination.TransactionPayment -> {
(t as? TransactionPayment)?.let { tx ->
LaunchedEffect(tx.txState) {
- if (tx.txState.major == TransactionMajorState.Dialog) {
+ // A wallet-core-prepared payment arrives in `Pending', not `Dialog'.
+ if (tx.txState.major == TransactionMajorState.Dialog ||
+ (destination.promptMode &&
+ tx.txState.major == TransactionMajorState.Pending)
+ ) {
model.paymentManager.getPaymentChoices(tx.transactionId) {}
}
}