commit 5fc32205c315b36dafc0441ddb57f1ed9e109914
parent 33a0b2b3933d014ef29ba5741fb68e827ade3bfa
Author: Marc Stibane <marc@taler.net>
Date: Thu, 18 Sep 2025 17:30:51 +0000
mayChangeSpeed
Diffstat:
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/TalerWallet1/Views/OIM/OIMbackground.swift b/TalerWallet1/Views/OIM/OIMbackground.swift
@@ -16,9 +16,17 @@ struct OIMamountV: View {
let amount: Amount?
let currencyName: String
let factor: Int // workaround because TEST has no large denominations, so we multiply with 100
+ let mayChangeSpeed: Bool
@State private var color = Color.accentColor
+ init(amount: Amount?, currencyName: String, factor: Int, mayChangeSpeed: Bool = true) {
+ self.amount = amount
+ self.currencyName = currencyName
+ self.factor = factor
+ self.mayChangeSpeed = mayChangeSpeed
+ }
+
func updateColor() {
#if DEBUG
color = debugAnimations ? .orange
@@ -29,6 +37,7 @@ struct OIMamountV: View {
: WalletColors().confirm
#endif
}
+
var body: some View {
if let amount {
if let amount2 = try? amount * UInt32(factor) { // workaround for CFA, HUF, JPY
@@ -41,27 +50,31 @@ struct OIMamountV: View {
}
#if DEBUG
.onTapGesture(count: 2) {
- if debugAnimations {
- debugAnimations = false
- fastAnimations = true
- } else {
- debugAnimations = true
+ if mayChangeSpeed {
+ if debugAnimations {
+ debugAnimations = false
+ fastAnimations = true
+ } else {
+ debugAnimations = true
+ }
+ updateColor()
}
- updateColor()
}
#endif
.onTapGesture(count: 1) {
+ if mayChangeSpeed {
#if DEBUG
- if debugAnimations {
- debugAnimations = false
- fastAnimations = false
- } else {
- fastAnimations.toggle()
- }
+ if debugAnimations {
+ debugAnimations = false
+ fastAnimations = false
+ } else {
+ fastAnimations.toggle()
+ }
#else
- fastAnimations.toggle()
+ fastAnimations.toggle()
#endif
- updateColor()
+ updateColor()
+ }
}
}
}