commit 8110de6d6acea04417219750a308c3532579b246 parent 9a00cfc4b7c28af70b71ce92d727039dacfc8aca Author: Marc Stibane <marc@taler.net> Date: Mon, 22 Jun 2026 20:09:08 +0200 improve payment currency message Diffstat:
6 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -45,6 +45,7 @@ struct P2pPayURIView: View { PeerPullDebitView(stack: stack.push(), raw: peerPullDebitResponse.amountRaw, effective: peerPullDebitResponse.amountEffective, + isDone: false, scope: peerPullDebitResponse.scopeInfo, summary: peerPullDebitResponse.contractTerms.summary) let expiration = peerPullDebitResponse.contractTerms.purse_expiration @@ -110,6 +111,7 @@ struct PeerPullDebitView: View { // let peerPullDebitResponse: PreparePeerPullDebitResponse let raw: Amount let effective: Amount + let isDone: Bool let scope: ScopeInfo? let summary: String @@ -120,7 +122,6 @@ struct PeerPullDebitView: View { // let raw = peerPullDebitResponse.amountRaw // let effective = peerPullDebitResponse.amountEffective // let scope = peerPullDebitResponse.scopeInfo - let currency = raw.currencyStr let fee = try! Amount.diff(raw, effective) ThreeAmountsSection(stack: stack.push(), scope: scope, @@ -132,7 +133,10 @@ struct PeerPullDebitView: View { bottomTitle: String(localized: "Amount to be spent:"), bottomAbbrev: String(localized: "Effective:", comment: "mini"), bottomAmount: effective, - large: false, pending: false, incoming: false, + large: false, + pendingDialog: false, + isDone: isDone, + incoming: false, baseURL: nil, txStateLcl: nil, summary: summary, diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -81,6 +81,7 @@ struct P2pReceiveURIView: View { PeerPushCreditView(stack: stack.push(), raw: peerPushCreditResponse.amountRaw, effective: peerPushCreditResponse.amountEffective, + isDone: false, scope: peerPushCreditResponse.scopeInfo, summary: peerPushCreditResponse.contractTerms.summary) ExpiresView(expiration: peerPushCreditResponse.contractTerms.purse_expiration) @@ -161,11 +162,11 @@ struct PeerPushCreditView: View { let stack: CallStack let raw: Amount let effective: Amount + let isDone: Bool let scope: ScopeInfo? let summary: String var body: some View { - let currency = raw.currencyStr let fee = try! Amount.diff(raw, effective) ThreeAmountsSection(stack: stack.push(), scope: scope, @@ -177,7 +178,10 @@ struct PeerPushCreditView: View { bottomTitle: String(localized: "Net Amount to receive:"), bottomAbbrev: String(localized: "Receive net:", comment: "mini"), bottomAmount: effective, - large: false, pending: false, incoming: true, + large: false, + pendingDialog: false, + isDone: isDone, + incoming: true, baseURL: nil, txStateLcl: nil, summary: summary, diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -167,7 +167,8 @@ struct PaymentView2: View, Sendable { bottomAbbrev: String(localized: "Effective:", comment: "mini"), bottomAmount: effective, large: false, - pending: !paid, + pendingDialog: !paid, + isDone: paid, incoming: false, baseURL: baseURL, txStateLcl: nil, @@ -191,7 +192,8 @@ struct PaymentView2: View, Sendable { bottomAbbrev: String(localized: "Available:", comment: "mini"), bottomAmount: balanceDetails.balanceAvailable, large: false, - pending: false, + pendingDialog: false, // TODO: true to always show currency the payment will be made in? + isDone: false, incoming: false, baseURL: baseURL, txStateLcl: nil, diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift @@ -89,7 +89,8 @@ struct WithdrawAcceptView: View { bottomAbbrev: String(localized: "Obtain:", comment: "Amount to obtain:"), bottomAmount: effective, large: false, - pending: false, + pendingDialog: false, + isDone: false, incoming: true, baseURL: exchange2.exchangeBaseUrl, txStateLcl: nil, // common.txState.major.localizedState diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift b/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift @@ -34,6 +34,7 @@ struct ThreeAmountsSheet: View { // should be in a separate file let fee = common.fee() let incoming = common.isIncoming let pending = common.isPending || common.isFinalizing + let dialog = common.isDialog let isDone = common.isDone let incomplete = !(isDone || pending) @@ -60,7 +61,8 @@ struct ThreeAmountsSheet: View { // should be in a separate file bottomAbbrev: bottomAbbrev ?? defaultBottomAbbrev, bottomAmount: incomplete ? nil : effective, large: large, - pending: pending, + pendingDialog: pending || dialog, + isDone: isDone, incoming: incoming, baseURL: baseURL, txStateLcl: txStateLcl, @@ -106,7 +108,8 @@ struct ThreeAmountsSection: View { var bottomAbbrev: String var bottomAmount: Amount? // nil = incomplete (aborted, timed out) let large: Bool - let pending: Bool + let pendingDialog: Bool + let isDone: Bool let incoming: Bool let baseURL: String? let txStateLcl: String? // localizedState @@ -166,8 +169,8 @@ struct ThreeAmountsSection: View { var body: some View { let currency = currencyInfo.currency let labelColor = WalletColors().labelColor - let foreColor = pending ? WalletColors().pendingColor(incoming) - : WalletColors().transactionColor(incoming) + let foreColor = pendingDialog ? WalletColors().pendingColor(incoming) + : WalletColors().transactionColor(incoming) let hasNoFees = noFees ?? false productImageSections Section { @@ -179,11 +182,12 @@ struct ThreeAmountsSection: View { } } - Text(pending ? "Payment will be made in \(currency)" - : "Payment was made in \(currency)") - .talerFont(.callout) - .padding(.top, 4) - + if pendingDialog || isDone { + Text(pendingDialog ? "Payment will be made in \(currency)" + : "Payment was made in \(currency)") + .talerFont(.callout) + .padding(.top, 4) + } AmountRowV(stack: stack.push(), title: minimalistic ? topAbbrev : topTitle, amount: topAmount, diff --git a/TalerWallet1/Views/Transactions/TransactionTypeDetail.swift b/TalerWallet1/Views/Transactions/TransactionTypeDetail.swift @@ -194,6 +194,7 @@ struct TransactionTypeDetail: View { PeerPushCreditView(stack: stack.push(), raw: common.amountRaw, effective: common.amountEffective, + isDone: common.isDone, scope: scope, summary: details.info.summary) PeerPushCreditAccept(stack: stack.push(), url: nil, @@ -203,6 +204,7 @@ struct TransactionTypeDetail: View { PeerPullDebitView(stack: stack.push(), raw: common.amountRaw, effective: common.amountEffective, + isDone: common.isDone, scope: scope, summary: details.info.summary) PeerPullDebitConfirm(stack: stack.push(), url: nil,