taler-ios

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

commit 0ce8de4c4b90340adb9c18d1f79d37a6bfe685da
parent f35e00a170540551b9f40f51cc2966916494fa3b
Author: Marc Stibane <marc@taler.net>
Date:   Fri,  4 Jul 2025 08:57:33 +0200

use amountToTransfer directly

Diffstat:
MTalerWallet1/Views/OIM/OIMEditView.swift | 20++++++++++++--------
MTalerWallet1/Views/OIM/OIMSubjectView.swift | 2+-
MTalerWallet1/Views/OIM/OIMView.swift | 2+-
MTalerWallet1/Views/OIM/OIMp2pReceiveView.swift | 2+-
4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/TalerWallet1/Views/OIM/OIMEditView.swift b/TalerWallet1/Views/OIM/OIMEditView.swift @@ -21,7 +21,7 @@ struct OIMEditView: View { @EnvironmentObject private var wrapper: NamespaceWrapper - @State private var amount2: Amount? +// @State private var amount2: Amount? @State private var amountVal: UInt64 = 0 @State private var sending = false // user tapped on Send @State private var availableVal: UInt64 = 0 @@ -86,13 +86,15 @@ struct OIMEditView: View { isFinal: false, isSierra: isSierra, isSending: sending, - amount: $amount2, +// amount: $amount2, + amount: amountToTransfer, action: sendAction ) { ZStack(alignment: .top) { VStack { // OIMtitleView(cash: cash, amount: availRest, isSending: true, secondAmount: amount) - OIMtitleView(cash: cash, amount: available, isSending: true, secondAmount: amount2) +// OIMtitleView(cash: cash, amount: available, isSending: true, secondAmount: amount2) + OIMtitleView(cash: cash, amount: available, isSending: true, secondAmount: amountToTransfer) Spacer() OIMlineView(stack: stack.push(), cash: cash, @@ -103,12 +105,14 @@ struct OIMEditView: View { .zIndex(1) // make notes fly from topZ .scaleEffect(sending ? 0.6 : 1.0) .onChange(of: amountVal) { newVal in - if let amountOld = amount2 { - let currencyStr = amountOld.currencyStr - amount2 = Amount(currency: currencyStr, cent: UInt64(newVal)) +// if let amountOld = amount2 { +// let currencyStr = amountOld.currencyStr + let currencyStr = amountToTransfer.currencyStr +// amount2 = Amount(currency: currencyStr, cent: UInt64(newVal)) + amountToTransfer = Amount(currency: currencyStr, cent: UInt64(newVal)) availableVal = isAvailable availRest = Amount(currency: currencyStr, cent: UInt64(availableVal)) - } +// } } if !sending { // need space for currency scroller Spacer() @@ -134,7 +138,7 @@ struct OIMEditView: View { } // ZStack } .task { // re-set cash to amount (once) - amount2 = amountToTransfer +// amount2 = amountToTransfer amountVal = amountToTransfer.centValue availableVal = isAvailable // print("OIMEditView.task", availableVal, amountVal) diff --git a/TalerWallet1/Views/OIM/OIMSubjectView.swift b/TalerWallet1/Views/OIM/OIMSubjectView.swift @@ -91,7 +91,7 @@ struct OIMSubjectView: View { isFinal: false, isSierra: isSierra, isSending: sending, - amount: $amount2, + amount: amount2, action: gotAction ) { VStack { diff --git a/TalerWallet1/Views/OIM/OIMView.swift b/TalerWallet1/Views/OIM/OIMView.swift @@ -18,7 +18,7 @@ struct OIMnavBack<Content: View>: View { let isFinal: Bool // bordered action button let isSierra: Bool let isSending: Bool // move action button - @Binding var amount: Amount? + let amount: Amount? let action: (() -> Void)? var content: () -> Content diff --git a/TalerWallet1/Views/OIM/OIMp2pReceiveView.swift b/TalerWallet1/Views/OIM/OIMp2pReceiveView.swift @@ -35,7 +35,7 @@ struct OIMp2pReceiveView: View { isFinal: false, isSierra: isSierra, isSending: false, - amount: $amount, + amount: amount, action: { } ) { Group {