commit ea0dbf2cd5023573001f5e674f6752530a243a4e
parent 0d5c4da404af9dc6df00b418728a7cfaa38c552a
Author: Marc Stibane <marc@taler.net>
Date: Mon, 7 Apr 2025 14:01:48 +0200
use NamespaceWrapper
Diffstat:
4 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/TalerWallet1/Views/OIM/OIMView.swift b/TalerWallet1/Views/OIM/OIMView.swift
@@ -148,7 +148,6 @@ struct OIMView: View {
Spacer()
OIMlineView(currency: currency,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
@@ -184,7 +183,6 @@ struct OIMPayView: View {
Spacer()
OIMlineView(currency: currency,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
@@ -231,7 +229,6 @@ struct OIMEditView: View {
Spacer()
OIMlineView(currency: currency,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
@@ -246,7 +243,6 @@ struct OIMEditView: View {
OIMcurrencyScroller(currency: currency,
availableVal: $availableVal,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: $tappedVal,
flying: $flying,
shake: $shake)
diff --git a/TalerWallet1/Views/OIM/OIMcurrencyScroller.swift b/TalerWallet1/Views/OIM/OIMcurrencyScroller.swift
@@ -13,11 +13,12 @@ struct OIMcurrencyScroller: View {
let currency: OIMcurrency
@Binding var availableVal: Int
@Binding var amountVal: Int
- let namespace: Namespace.ID
@Binding var tappedVal: Int
@Binding var flying: Int
@Binding var shake: Bool
+ @EnvironmentObject private var wrapper: NamespaceWrapper
+
func tap(value: Int, _ delay: Int = 250) {
withAnimation(.shake1) {
flying = 0
@@ -55,7 +56,7 @@ struct OIMcurrencyScroller: View {
pct: 0.0,
action: { tap(value: value) }
)
- .matchedGeometryEffect(id: value, in: namespace, isSource: true)
+ .matchedGeometryEffect(id: value, in: wrapper.namespace, isSource: true)
}
ForEach(currency.bankCoins, id: \.self) { value in
OIMcoinV(value: value,
@@ -65,7 +66,7 @@ struct OIMcurrencyScroller: View {
pct: 0.0,
action: { tap(value: value) }
)
- .matchedGeometryEffect(id: value, in: namespace, isSource: true)
+ .matchedGeometryEffect(id: value, in: wrapper.namespace, isSource: true)
}
}.padding(.trailing, UIScreen.hasNotch ? UIScreen.horzInsets : 0) // ensure scrolling over the FaceID notch
}
diff --git a/TalerWallet1/Views/OIM/OIMcurrencyViews.swift b/TalerWallet1/Views/OIM/OIMcurrencyViews.swift
@@ -144,13 +144,14 @@ struct OIMnoteStackV: View {
let value: Int
let count: Int
let currency: OIMcurrency
- let namespace: Namespace.ID
let tappedVal: Int
@Binding var flying: Int
let shake: Bool
let canEdit: Bool
let action: () -> Void
+ @EnvironmentObject private var wrapper: NamespaceWrapper
+
var body: some View {
// let _ = Self._printChanges()
let maxIndex = count - 1
@@ -173,7 +174,7 @@ struct OIMnoteStackV: View {
action: action)
.offset(x: xOffset + (direction ? shakeOffset : -shakeOffset),
y: yOffset)
- .matchedGeometryEffect(id: id, in: namespace, isSource: false)
+ .matchedGeometryEffect(id: id, in: wrapper.namespace, isSource: false)
.onAppear {
// print("start flying \(id), shaking \(shakeOffset)")
withAnimation(.fly1) {
@@ -192,13 +193,14 @@ struct OIMcoinStackV: View {
let value: Int
let count: Int
let currency: OIMcurrency
- let namespace: Namespace.ID
let tappedVal: Int
@Binding var flying: Int
let shake: Bool
let canEdit: Bool
let action: () -> Void
+ @EnvironmentObject private var wrapper: NamespaceWrapper
+
var body: some View {
let maxIndex = count - 1
if let size = currency.coinSize(value) {
@@ -221,7 +223,7 @@ struct OIMcoinStackV: View {
action: action)
.offset(x: xOffset + (direction ? shakeOffset : -shakeOffset),
y: yOffset)
- .matchedGeometryEffect(id: id, in: namespace, isSource: false)
+ .matchedGeometryEffect(id: id, in: wrapper.namespace, isSource: false)
.onAppear {
// print("start flying \(id), shaking \(shakeOffset)")
withAnimation(.fly1) {
diff --git a/TalerWallet1/Views/OIM/OIMlineViews.swift b/TalerWallet1/Views/OIM/OIMlineViews.swift
@@ -13,7 +13,6 @@ struct OIMnotesView1: View {
let spread: OIMdenominations
let currency: OIMcurrency
@Binding var amountVal: Int
- let namespace: Namespace.ID
let tappedVal: Int
@Binding var flying: Int
let shake: Bool
@@ -31,7 +30,6 @@ struct OIMnotesView1: View {
OIMnoteStackV(value: value,
count: count,
currency: currency,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
@@ -51,7 +49,6 @@ struct OIMcoinsView1: View {
let spread: OIMdenominations
let currency: OIMcurrency
@Binding var amountVal: Int
- let namespace: Namespace.ID
let tappedVal: Int
@Binding var flying: Int
let shake: Bool
@@ -68,7 +65,6 @@ struct OIMcoinsView1: View {
OIMcoinStackV(value: value,
count: count,
currency: currency,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
@@ -89,12 +85,12 @@ fileprivate let vertSpacing: CGFloat = 10
struct OIMlineView: View {
let currency: OIMcurrency
@Binding var amountVal: Int
- let namespace: Namespace.ID
let tappedVal: Int
@Binding var flying: Int
let shake: Bool
let canEdit: Bool
+ @EnvironmentObject private var wrapper: NamespaceWrapper
@AppStorage("oimTwoRows") var oimTwoRows: Bool = false
var body: some View {
@@ -111,26 +107,24 @@ struct OIMlineView: View {
let notes = OIMnotesView1(spread: result.0,
currency: currency,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
canEdit: canEdit
).id("notes")
- .matchedGeometryEffect(id: "notes", in: namespace)
+ .matchedGeometryEffect(id: "notes", in: wrapper.namespace)
#if DEBUG
.border(blue)
#endif
let coins = OIMcoinsView1(spread: result.1,
currency: currency,
amountVal: $amountVal,
- namespace: namespace,
tappedVal: tappedVal,
flying: $flying,
shake: shake,
canEdit: canEdit
).id("coins")
- .matchedGeometryEffect(id: "coins", in: namespace)
+ .matchedGeometryEffect(id: "coins", in: wrapper.namespace)
#if DEBUG
.border(red)
#endif