commit 9fa1fbebdbe903b34e1b75f4bdcc3ced1ebdc117
parent 381f70c4a80de0323fa8313ec5afea6af6257998
Author: Marc Stibane <marc@taler.net>
Date: Sat, 17 May 2025 17:45:59 +0200
amountToTransfer
Diffstat:
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift
@@ -186,7 +186,7 @@ struct P2PSubjectV: View {
OIMSubjectView(stack: stack.push(),
cash: cash,
available: available,
- amount: $amountToTransfer,
+ amountToTransfer: $amountToTransfer,
selectedGoal: $iconID,
fwdButtonTapped: $sendOrRequest)
.environmentObject(NamespaceWrapper(namespace)) // keep OIMviews apart
diff --git a/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift b/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift
@@ -21,9 +21,7 @@ struct SendAmountV: View {
@EnvironmentObject private var controller: Controller
@EnvironmentObject private var model: WalletModel
-//#if OIM
@StateObject private var cash: OIMcash
-//#endif
@State private var balanceIndex = 0
@State private var balance: Balance? = nil // nil only when balances == []
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@@ -146,7 +144,7 @@ struct SendAmountV: View {
amountAvailable
OIMEditView(stack: stack.push(),
cash: cash,
- amount: $amountToTransfer,
+ amountToTransfer: $amountToTransfer,
available: available,
useAvailable: true, // cannot send more than we have
fwdButtonTapped: $buttonSelected)
diff --git a/TalerWallet1/Views/OIM/OIMEditView.swift b/TalerWallet1/Views/OIM/OIMEditView.swift
@@ -13,7 +13,7 @@ import taler_swift
struct OIMEditView: View {
let stack: CallStack
let cash: OIMcash
- @Binding var amount: Amount
+ @Binding var amountToTransfer: Amount
let available: Amount
let useAvailable : Bool // if false then we're requesting money and don't use available
// let decimal: Int // 0 for ¥,HUF; 2 for $,€,£; 3 for ﷼,₯ (arabic)
@@ -28,15 +28,16 @@ struct OIMEditView: View {
@State private var availRest: Amount
@State private var tappedVal: UInt64 = 0
- init(stack: CallStack, cash: OIMcash,
- amount: Binding<Amount>,
- available: Amount,
- useAvailable : Bool,
- fwdButtonTapped: Binding<Bool>
+ init(stack: CallStack,
+ cash: OIMcash,
+ amountToTransfer: Binding<Amount>,
+ available: Amount,
+ useAvailable: Bool,
+ fwdButtonTapped: Binding<Bool>
) {
self.stack = stack
self.cash = cash
- self._amount = amount
+ self._amountToTransfer = amountToTransfer
self.available = available
self.useAvailable = useAvailable
self._fwdButtonTapped = fwdButtonTapped
@@ -48,7 +49,7 @@ struct OIMEditView: View {
var isAvailable: UInt64 {
if useAvailable {
let have = available.centValue
- let want = amount.centValue
+ let want = amountToTransfer.centValue
if have > want {
return have - want
}
@@ -133,8 +134,8 @@ struct OIMEditView: View {
} // ZStack
}
.task { // re-set cash to amount (once)
- amount2 = amount
- amountVal = amount.centValue
+ amount2 = amountToTransfer
+ amountVal = amountToTransfer.centValue
availableVal = isAvailable
// print("OIMEditView.task", availableVal, amountVal)
cash.update(amountVal)
diff --git a/TalerWallet1/Views/OIM/OIMSubjectView.swift b/TalerWallet1/Views/OIM/OIMSubjectView.swift
@@ -52,7 +52,7 @@ struct OIMSubjectView: View {
let stack: CallStack
let cash: OIMcash
let available: Amount
- @Binding var amount: Amount
+ @Binding var amountToTransfer: Amount
@Binding var selectedGoal: String?
// let decimal: Int // 0 for ¥,HUF; 2 for $,€,£; 3 for ﷼,₯ (arabic)
@Binding var fwdButtonTapped: Bool
@@ -93,7 +93,7 @@ struct OIMSubjectView: View {
action: sendAction
) {
VStack {
- OIMtitleView(cash: cash, amount: available, isSending: true, secondAmount: amount)
+ OIMtitleView(cash: cash, amount: available, isSending: true, secondAmount: amountToTransfer)
Spacer()
GoalsHStack(goals: goals1, selectedGoal: $selectedGoal)
.opacity(appeared ? 1.0 : 0.01)
@@ -111,8 +111,8 @@ struct OIMSubjectView: View {
}
// .border(.red)
}.task {
- amount2 = amount
- amountVal = amount.centValue
+ amount2 = amountToTransfer
+ amountVal = amountToTransfer.centValue
withAnimation(.basic1) {
appeared = true
}