taler-ios

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

commit dc3603f268021f4c112488f6fd1400ff7a40d1c0
parent b5de189608e3c47559b12aaf36da5aef6d1b24df
Author: Marc Stibane <marc@taler.net>
Date:   Tue, 22 Apr 2025 12:04:53 +0200

returning instead flipping

Diffstat:
MTalerWallet1/Views/OIM/OIMcash.swift | 12++++++------
MTalerWallet1/Views/OIM/OIMcurrencyButton.swift | 1-
MTalerWallet1/Views/OIM/OIMlayout.swift | 6+++---
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/TalerWallet1/Views/OIM/OIMcash.swift b/TalerWallet1/Views/OIM/OIMcash.swift @@ -14,7 +14,7 @@ let MAXSTACK = 4 enum FundState: Int { case idle - case flipping // user tapped to remove + case returning // user tapped to remove case shouldFly // + button tapped case isFlying // after onAppear @@ -26,7 +26,7 @@ enum FundState: Int { case arriving // keep flipped image, move to final position case mutating // flip back with disbled transition - var flipping: Bool { self == .flipping } + var returning: Bool { self == .returning } var shouldFly: Bool { self == .shouldFly } var isFlying: Bool { self == .isFlying } var position: Bool { self == .position } @@ -46,12 +46,12 @@ public struct OIMfund: Identifiable, Equatable, Hashable, Sendable { var outValue: UInt64? // if this is set it determines the image (used for flipping) var targetID: String { - String(state.shouldFly ? -Int(value) // match sourceID - : id) + String(state.shouldFly || state.returning ? -Int(value) // match sourceID + : id) } var shouldFly: Bool { state.shouldFly } var isFlying: Bool { state.isFlying } - var isFlipping: Bool { state.flipping } +// var isFlipping: Bool { state.flipping } } public typealias OIMfunds = [OIMfund] @@ -298,7 +298,7 @@ final class OIMcash: ObservableObject, Sendable { func removeCash(id: Int, value: UInt64) { if let index = funds.firstIndex(where: { $0.id == id && $0.value == value }) { funds.remove(at: index) - } else if let index = funds.lastIndex(where: { $0.value == value && $0.state.flipping }) { + } else if let index = funds.lastIndex(where: { $0.value == value && $0.state.returning }) { funds.remove(at: index) } else if let index = funds.firstIndex(where: { $0.value == value }) { funds.remove(at: index) diff --git a/TalerWallet1/Views/OIM/OIMcurrencyButton.swift b/TalerWallet1/Views/OIM/OIMcurrencyButton.swift @@ -137,7 +137,6 @@ struct OIMcurrencyButton: View { // Use EmptyView, because the modifier actually ignores // the value passed to its body() function. let isFlipped: Bool = switch state { - case .flipping: true case .morphing: true case .arriving: true default: false diff --git a/TalerWallet1/Views/OIM/OIMlayout.swift b/TalerWallet1/Views/OIM/OIMlayout.swift @@ -92,9 +92,9 @@ struct OIMlayoutView: View { func flipRemove(fundID: Int) { if let index = funds.firstIndex(where: { $0.id == fundID }) { var fund = funds[index] - symLog.log("*** start flipping:\(fund.value) \(fundID)") - withAnimation(.basic1) { - fund.state = .flipping + symLog.log("*** fly back:\(fund.value) \(fundID)") + withAnimation(.move1) { + fund.state = .returning cash.updateFund(fund) } DispatchQueue.main.asyncAfter(deadline: .now() + cash.delay) {