commit 5d01074f0a281232957a600288d5941ba6f12fbb
parent 723b206f3637e6550d5be01303faeaa581201c09
Author: Marc Stibane <marc@taler.net>
Date: Sun, 9 Aug 2026 21:49:53 +0200
assure loaded choices belong to tx
Diffstat:
1 file changed, 39 insertions(+), 33 deletions(-)
diff --git a/TalerWallet1/Views/Transactions/PaymentTransactionView.swift b/TalerWallet1/Views/Transactions/PaymentTransactionView.swift
@@ -141,43 +141,49 @@ struct PaymentTransactionView: View {
let choicesTuple = controller.choicesTuple
if let txId = choicesTuple.0, let choicesForPayment = choicesTuple.1 {
- if let (choices, showHeader) = choicesForPayment.choiceTriple() {
- let hasAutomatic = choicesForPayment.automaticExecution ?? false
- let automaticIndex = hasAutomatic ? choicesForPayment.automaticExecutableIndex : nil
- ChoicesView(stack: stack.push(),
- choiceTriple: choices,
- showHeader: showHeader,
- automaticIndex: automaticIndex,
- selectedChoice: $selectedChoice)
- .task {
- automaticOrDefault(automaticIndex, choicesForPayment.defaultChoiceIndex, of: choices)
- }
- .onChange(of: selectedChoice) { newValue in
- if let newValue, newValue < choices.count {
- let newChoice = choices[newValue]
- effective = newChoice.0.amountEffective
- scope = newChoice.0.scopeInfo
- } else {
- effective = nil
- scope = nil
+ if txId == common.transactionId {
+ if let (choices, showHeader) = choicesForPayment.choiceTriple() {
+ let hasAutomatic = choicesForPayment.automaticExecution ?? false
+ let automaticIndex = hasAutomatic ? choicesForPayment.automaticExecutableIndex : nil
+ ChoicesView(stack: stack.push(),
+ choiceTriple: choices,
+ showHeader: showHeader,
+ automaticIndex: automaticIndex,
+ selectedChoice: $selectedChoice)
+ .task {
+ automaticOrDefault(automaticIndex, choicesForPayment.defaultChoiceIndex, of: choices)
+ }
+ .onChange(of: selectedChoice) { newValue in
+ if let newValue, newValue < choices.count {
+ let newChoice = choices[newValue]
+ effective = newChoice.0.amountEffective
+ scope = newChoice.0.scopeInfo
+ } else {
+ effective = nil
+ scope = nil
+ }
}
- }
- if let selectedChoice {
- let choice = choices[selectedChoice]
- let selectionDetail: ChoiceSelectionDetail = choice.0
-// let contractChoice: ContractChoice = choice.1
+ if let selectedChoice {
+ let choice = choices[selectedChoice]
+ let selectionDetail: ChoiceSelectionDetail = choice.0
+ // let contractChoice: ContractChoice = choice.1
- PaymentView2(stack: stack.push(), // TODO: details.info.merchant.name
- paid: false,
- raw: selectionDetail.amountRaw,
- effective: effective,
- firstScope: scope,
- baseURL: nil,
- summary: summary(details.info),
- products: details.info?.products ?? [],
- balanceDetails: selectionDetail.balanceDetails)
+ PaymentView2(stack: stack.push(), // TODO: details.info.merchant.name
+ paid: false,
+ raw: selectionDetail.amountRaw,
+ effective: effective,
+ firstScope: scope,
+ baseURL: nil,
+ summary: summary(details.info),
+ products: details.info?.products ?? [],
+ balanceDetails: selectionDetail.balanceDetails)
+ }
+ } else { // should never happen...
+ // TODO: show some error
}
+ } else { // cached data outdated
+ // TODO: purge and reload
}
}
} else { // show finished payment