commit 7b71e5c08fda46fd657a891486b2a45d5be3d01a parent 1fbf8e883a5a703cf1dcffe54c721be28ffc83d9 Author: Marc Stibane <marc@taler.net> Date: Sun, 31 Aug 2025 20:13:33 +0200 cleanup Diffstat:
6 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/TalerWallet1/Model/Transaction.swift b/TalerWallet1/Model/Transaction.swift @@ -353,6 +353,11 @@ struct TransactionCommon: Decodable, Sendable { var kycUrl: String? var kycAuthTransferInfo: KycAuthTransferInfo? + var isIncoming : Bool { type == .withdrawal + || type == .refund + || type == .peerPullCredit + || type == .scanPushCredit } + var isPending : Bool { txState.major == .pending } var isPendingReady : Bool { isPending && txState.isReady } var isPendingKYC : Bool { isPending && txState.isKYC } @@ -424,13 +429,6 @@ struct TransactionCommon: Decodable, Sendable { } catch {} return Amount.zero(currency: amountRaw.currencyStr) } - - func incoming() -> Bool { - return type == .withdrawal - || type == .refund - || type == .peerPullCredit - || type == .scanPushCredit - } } // MARK: - Withdrawal struct WithdrawalDetails: Decodable { diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift @@ -79,7 +79,7 @@ struct BarGraph: View { if count > 0 { ForEach(tenTransactions, id: \.self) {transaction in let common = transaction.common - let incoming = common.incoming() + let incoming = common.isIncoming let netto = common.amountEffective.value let valueColored = barHeight * netto / maxValue let valueTransparent = barHeight - valueColored diff --git a/TalerWallet1/Views/HelperViews/IconBadge.swift b/TalerWallet1/Views/HelperViews/IconBadge.swift @@ -50,7 +50,7 @@ struct TransactionIconBadge: View { self.type = common.type let done = transaction.isDone self.done = done - let incoming = common.incoming() + let incoming = common.isIncoming self.incoming = incoming let needsKYC = transaction.isPendingKYC || transaction.isPendingKYCauth self.needsKYC = needsKYC diff --git a/TalerWallet1/Views/OIM/OIMtransactions.swift b/TalerWallet1/Views/OIM/OIMtransactions.swift @@ -227,7 +227,7 @@ extension OIMtransactions { func lineMark(for talerTransaction: TalerTransaction) -> LineMarkData { let common = talerTransaction.common let amount = common.amountEffective - let incoming = common.incoming() + let incoming = common.isIncoming let timestamp = common.timestamp let date = try! Date(milliseconds: timestamp.milliseconds()) let components = calendar.dateComponents([.year, .month, .day, .weekOfMonth], from: date) diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift b/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift @@ -33,7 +33,7 @@ struct ThreeAmountsSheet: View { // should be in a separate file let raw = common.amountRaw let effective = common.amountEffective let fee = common.fee() - let incoming = common.incoming() + let incoming = common.isIncoming let pending = common.isPending || common.isFinalizing let isDone = common.isDone let incomplete = !(isDone || pending) diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -107,7 +107,7 @@ struct TransactionRowView: View { let keys = details.keys let common = transaction.common let isZero = common.amountEffective.isZero - let incoming = common.incoming() + let incoming = common.isIncoming let textColor = doneOrPending ? .primary : colorScheme == .dark ? .secondary : increasedContrast ? Color(.darkGray)