taler-ios

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

commit 1e85098be78edb6bced580ece9559fb1434f2ffe
parent b55636052a215c175e6a9f1bd341fa5827e85321
Author: Marc Stibane <marc@taler.net>
Date:   Wed, 23 Jul 2025 20:46:34 +0200

selectedBalance <-> oimCurrency

Diffstat:
MTalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift | 13++++++++-----
MTalerWallet1/Views/Main/MainView.swift | 2+-
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift b/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift @@ -14,7 +14,7 @@ struct SendAmountV: View { private let symLog = SymLogV(0) let stack: CallStack // when Action is tapped while in currency TransactionList… - let selectedBalance: Balance? // …then use THIS balance, otherwise show picker + @Binding var selectedBalance: Balance? // …then use THIS balance, otherwise show picker // coming from transaction list or OIM @Binding var amountLastUsed: Amount @Binding var summary: String @@ -33,7 +33,7 @@ struct SendAmountV: View { @Namespace var namespace init(stack: CallStack, - selectedBalance: Balance?, + selectedBalance: Binding<Balance?>, amountLastUsed: Binding<Amount>, summary: Binding<String>, iconID: Binding<String?> @@ -42,11 +42,11 @@ struct SendAmountV: View { // closure only once during the lifetime of the view, so // later changes to the currency have no effect. self.stack = stack - self.selectedBalance = selectedBalance + self._selectedBalance = selectedBalance self._amountLastUsed = amountLastUsed self._summary = summary self._iconID = iconID - let oimCurrency = oimCurrency(selectedBalance) // might be nil ==> OIMeuros + let oimCurrency = oimCurrency(selectedBalance.wrappedValue) // might be nil ==> OIMeuros let oimCash = OIMcash(oimCurrency) self._cash = StateObject(wrappedValue: { oimCash }()) } @@ -86,6 +86,9 @@ struct SendAmountV: View { // TODO: Error amountAvailable = balance.available } + selectedBalance = balance + let oimCurrency = oimCurrency(balance) // might be nil ==> OIMeuros + cash.currency = oimCurrency } } @@ -187,7 +190,7 @@ fileprivate struct Preview_Content: View { pendingOutgoing: pending, flags: []) SendAmountV(stack: CallStack("Preview"), - selectedBalance: noBalance, + selectedBalance: $noBalance, amountLastUsed: $amountToPreview, summary: $summary, iconID: $iconID) diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift @@ -407,7 +407,7 @@ extension MainView { private var tabContent: some View { /// Destinations for the 4 actions let sendDest = SendAmountV(stack: stack.push(Self.name), - selectedBalance: selectedBalance, // if nil shows currency picker + selectedBalance: $selectedBalance, // if nil shows currency picker amountLastUsed: $amountLastUsed, // currency needs to be updated! summary: $summary, iconID: $iconID)