taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 09e7fc76020aa377cc58da1bbe5697ba35e73505
parent aeda8be7716fa03b88832d1583f69b3870691d50
Author: Marc Stibane <marc@taler.net>
Date:   Fri, 27 Nov 2026 08:13:00 +0100

simplify

Diffstat:
MTalerWallet1/Model/WalletModel.swift | 6+++---
MTalerWallet1/Views/Sheets/Payment/PaymentScan.swift | 10++++++----
MTalerWallet1/Views/Transactions/TransactionSummaryList.swift | 8++++----
3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/TalerWallet1/Model/WalletModel.swift b/TalerWallet1/Model/WalletModel.swift @@ -251,7 +251,7 @@ extension WalletModel { } // MARK: - struct WaitTransactionResult: Decodable, Sendable { - var matched: String? + var matched: String? // "target" | "bail" var txState: TransactionState? } @@ -333,7 +333,7 @@ fileprivate struct JSONTransactionById: WalletBackendFormattedRequest { extension WalletModel { nonisolated func waitTransactionState(_ txId: String, token: String, major: TransactionMajorState) - async throws -> WaitTransactionResult { + async throws -> Bool { let txState = TransactionState(major: major, minor: .any, working: nil) let request = WaitTransactionState(txId: txId, txState: txState, token: token) let controller = Controller.shared @@ -342,7 +342,7 @@ extension WalletModel { controller.lastProgressError = nil controller.lastProgressPhase = nil let (response, _) = try await sendRequest(request) - return response + return response.matched?.lowercased() == "target" } nonisolated func cancelProgressToken(_ op: String, token: String) async throws { diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentScan.swift b/TalerWallet1/Views/Sheets/Payment/PaymentScan.swift @@ -85,11 +85,13 @@ struct PaymentScan: View, Sendable { } } if let txId { - if let finalResult = try? await model.waitTransactionState(txId, token: txId, major: .dialog) { - if let matched = finalResult.matched { - print(matched) - } + if let matched = try? await model.waitTransactionState(txId, token: txId, major: .dialog), matched { + symLog.log("waitTransactionState matched") + } else { + symLog.log("PaymentScan: waitTransactionState bail") // TODO: ??? } + } else { + // TODO: didn't get a txId } } diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryList.swift b/TalerWallet1/Views/Transactions/TransactionSummaryList.swift @@ -110,10 +110,10 @@ struct TransactionSummaryList: View { } } let txId = confirmPayResult.transactionId - if let finalResult = try? await model.waitTransactionState(txId, token: txId, major: .done) { - if let matched = finalResult.matched { - print(matched) - } + if let matched = try? await model.waitTransactionState(txId, token: txId, major: .done), matched { + symLog.log("waitTransactionState matched") + } else { + symLog.log("payTransaction: waitTransactionState bail") // TODO: ??? } } }