commit 855f07b71b14bd20ee476ed8dff9968893b74742
parent 2f5143cf79f5c969368b33f8776c13b8b78412b1
Author: Marc Stibane <marc@taler.net>
Date: Wed, 23 Jul 2025 09:28:59 +0200
simplify navBack
Diffstat:
4 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/TalerWallet1/Views/OIM/OIMEditView.swift b/TalerWallet1/Views/OIM/OIMEditView.swift
@@ -80,13 +80,11 @@ struct OIMEditView: View {
// let _ = print(">>> OIMEditView", available, amount, stack.peek()?.file)
OIMnavBack(stack: stack.push(),
- currencyName: cash.currency.currencyStr,
chest: cash.currency.chest,
isFinal: false,
isSending: sending,
-// amount: $amount2,
- amount: amountToTransfer,
- action: sendAction
+ action: sendAction,
+ actDisabled: amountToTransfer.isZero
) {
ZStack(alignment: .top) {
VStack {
diff --git a/TalerWallet1/Views/OIM/OIMSubjectView.swift b/TalerWallet1/Views/OIM/OIMSubjectView.swift
@@ -84,12 +84,12 @@ struct OIMSubjectView: View {
let gotAction = (selectedGoal != nil) ? sendAction : nil
OIMnavBack(stack: stack.push(),
- currencyName: currency.currencyStr,
chest: currency.chest,
isFinal: false,
isSending: sending,
- amount: amount2,
- action: gotAction
+ action: gotAction,
+ actDisabled: amount2?.isZero ?? true
+
) {
VStack {
OIMtitleView(cash: cash,
diff --git a/TalerWallet1/Views/OIM/OIMp2pReceiveView.swift b/TalerWallet1/Views/OIM/OIMp2pReceiveView.swift
@@ -27,12 +27,11 @@ struct OIMp2pReceiveView: View {
// let _ = Self._printChanges()
let currency = cash.currency
OIMnavBack(stack: stack.push(),
- currencyName: currency.currencyStr,
chest: currency.chest,
isFinal: false,
isSending: false,
- amount: amount,
- action: { }
+ action: { },
+ actDisabled: amount?.isZero ?? true
) {
Group {
if let peerPushCreditResponse {
diff --git a/TalerWallet1/Views/OIM/OIMviews.swift b/TalerWallet1/Views/OIM/OIMviews.swift
@@ -21,12 +21,11 @@ let OIMSIDE = "OIMside"
// MARK: -
struct OIMnavBack<Content: View>: View {
let stack: CallStack
- let currencyName: String
let chest: String
let isFinal: Bool // bordered action button
let isSending: Bool // move action button
- let amount: Amount?
let action: (() -> Void)?
+ let actDisabled: Bool
var content: () -> Content
@Environment(\.dismiss) var dismiss // pop back once
@@ -37,7 +36,7 @@ struct OIMnavBack<Content: View>: View {
ZStack(alignment: .top) {
content()
VStack {
- HStack {
+ HStack { // top: chest <-> action
OIMbalanceButton(isOpen: true, chest: chest, isFinal: false) {
var transaction = Transaction()
transaction.disablesAnimations = true // doesn't work with NavigationView
@@ -50,10 +49,9 @@ struct OIMnavBack<Content: View>: View {
}
.frame(width: OIMbuttonSize, height: OIMbuttonSize)
Spacer()
- let amountIsZero = amount?.isZero ?? true
OIMactionButton(type: .sendP2P,
isFinal: isFinal,
- action: amountIsZero ? nil : action)
+ action: actDisabled ? nil : action)
.frame(width: OIMactionSize, height: OIMbuttonSize)
.matchedGeometryEffect(id: isSending ? OIMACTION : OIMACTION2,
in: wrapper.namespace, isSource: false)