taler-ios

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

commit 1e7321141ed3d556e30dac11d4c074705025a2c0
parent eaebfe098bb721f5184d6b76ddc313a0db07357f
Author: Marc Stibane <marc@taler.net>
Date:   Wed, 17 Jul 2024 08:23:13 +0200

stack

Diffstat:
MTalerWallet1/Views/Balances/BalanceRowView.swift | 12+++++++-----
MTalerWallet1/Views/HelperViews/AmountRowV.swift | 6++++--
MTalerWallet1/Views/HelperViews/AmountV.swift | 2++
MTalerWallet1/Views/Overview/OverviewRowV.swift | 12+++++++-----
MTalerWallet1/Views/Transactions/ThreeAmountsV.swift | 9++++++---
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 7++++---
6 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift @@ -9,6 +9,7 @@ import SwiftUI import taler_swift struct BalanceCell: View { + let stack: CallStack? let amount: Amount let sizeCategory: ContentSizeCategory let rowAction: () -> Void @@ -21,7 +22,7 @@ struct BalanceCell: View { /// Renders the Balance button. "Balance" leading, amountStr trailing. If it doesn't fit in one row then /// amount (trailing) goes underneath "Balance" (leading). var body: some View { - let amountV = AmountV(amount: amount, isNegative: false, large: true) + let amountV = AmountV(stack: stack?.push("AmountV"), amount: amount, isNegative: false, large: true) .foregroundColor(.primary) let hLayout = amountV .frame(maxWidth: .infinity, alignment: .trailing) @@ -86,10 +87,11 @@ struct BalanceRowView: View { let requestTitle1 = String(localized: "RequestButton_Full", defaultValue: "Request\t\(currencyName)", comment: "`Request (currency)ยด in Balances - must have ONE \\t and ONE %@") VStack (alignment: .trailing, spacing: 6) { - BalanceCell(amount: amount, - sizeCategory: sizeCategory, - rowAction: rowAction, - balanceDest: balanceDest) + BalanceCell(stack: stack.push("BalanceCell"), + amount: amount, + sizeCategory: sizeCategory, + rowAction: rowAction, + balanceDest: balanceDest) // .border(.red) let sendTitle = minimalistic ? sendTitle0 : sendTitle1 diff --git a/TalerWallet1/Views/HelperViews/AmountRowV.swift b/TalerWallet1/Views/HelperViews/AmountRowV.swift @@ -10,6 +10,7 @@ import taler_swift // Title and Amount struct AmountRowV: View { + let stack: CallStack? let title: String let amount: Amount let isNegative: Bool // if true, show a "-" before the amount @@ -20,7 +21,7 @@ struct AmountRowV: View { let titleV = Text(title) .multilineTextAlignment(.leading) .talerFont(.body) - let amountV = AmountV(amount: amount, isNegative: isNegative, large: large) + let amountV = AmountV(stack: stack?.push(), amount: amount, isNegative: isNegative, large: large) .foregroundColor(color) let verticalV = VStack(alignment: .leading) { titleV @@ -57,6 +58,7 @@ struct AmountRowV: View { } extension AmountRowV { init(title: String, amount: Amount, isNegative: Bool, color: Color) { + self.stack = nil self.title = title self.amount = amount self.isNegative = isNegative @@ -77,7 +79,7 @@ fileprivate func talerFromStr(_ from: String) -> Amount { #Preview { List { let fee = Amount(currency: "Taler", cent: 20) - AmountRowV(title: "Fee", amount: fee, isNegative: true, color: Color("Outgoing"), large: false) + AmountRowV(stack: nil, title: "Fee", amount: fee, isNegative: true, color: Color("Outgoing"), large: false) let cents = Amount(currency: "Taler", cent: 480) AmountRowV(title: "Cents", amount: cents, isNegative: false, color: Color("Incoming")) let amount = talerFromStr("Taler:4.80") diff --git a/TalerWallet1/Views/HelperViews/AmountV.swift b/TalerWallet1/Views/HelperViews/AmountV.swift @@ -9,6 +9,7 @@ import SwiftUI import taler_swift struct AmountV: View { + let stack: CallStack? let amount: Amount let isNegative: Bool // if true, show a "-" before the amount let large: Bool // set to false for QR or IBAN @@ -26,6 +27,7 @@ struct AmountV: View { } extension AmountV { init(_ amount: Amount, isNegative: Bool) { + self.stack = nil self.amount = amount self.isNegative = isNegative self.large = false diff --git a/TalerWallet1/Views/Overview/OverviewRowV.swift b/TalerWallet1/Views/Overview/OverviewRowV.swift @@ -9,6 +9,7 @@ import SwiftUI import taler_swift struct CurrenciesCell: View { + let stack: CallStack let amount: Amount let sizeCategory: ContentSizeCategory let rowAction: () -> Void @@ -21,7 +22,7 @@ struct CurrenciesCell: View { /// Renders the Balance button. "Balance" leading, amountStr trailing. If it doesn't fit in one row then /// amount (trailing) goes underneath "Balance" (leading). var body: some View { - let amountV = AmountV(amount: amount, isNegative: false, large: true) + let amountV = AmountV(stack: stack.push(), amount: amount, isNegative: false, large: true) .foregroundColor(.primary) let hLayout = amountV .frame(maxWidth: .infinity, alignment: .trailing) @@ -76,10 +77,11 @@ struct OverviewRowV: View { var body: some View { VStack (alignment: .trailing, spacing: 6) { - CurrenciesCell(amount: amount, - sizeCategory: sizeCategory, - rowAction: rowAction, - balanceDest: balanceDest) + CurrenciesCell(stack: stack.push(), + amount: amount, + sizeCategory: sizeCategory, + rowAction: rowAction, + balanceDest: balanceDest) // .border(.red) } } diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift @@ -102,7 +102,8 @@ struct ThreeAmountsV: View { .lineLimit(4) .padding(.bottom) } - AmountRowV(title: minimalistic ? topAbbrev : topTitle, + AmountRowV(stack: stack.push(), + title: minimalistic ? topAbbrev : topTitle, amount: topAmount, isNegative: !incoming, color: labelColor, @@ -112,7 +113,8 @@ struct ThreeAmountsV: View { if let fee { let title = minimalistic ? String(localized: "Exchange fee (short):", defaultValue: "Fee:", comment: "short version") : String(localized: "Exchange fee (long):", defaultValue: "Fee:", comment: "long version") - AmountRowV(title: title, + AmountRowV(stack: stack.push(), + title: title, amount: fee, isNegative: !incoming, color: labelColor, @@ -120,7 +122,8 @@ struct ThreeAmountsV: View { .padding(.bottom, 4) } if let bottomAmount { - AmountRowV(title: minimalistic ? bottomAbbrev : bottomTitle, + AmountRowV(stack: stack.push(), + title: minimalistic ? bottomAbbrev : bottomTitle, amount: bottomAmount, isNegative: !incoming, color: foreColor, diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -342,13 +342,15 @@ struct TransactionSummaryV: View { Text(details.refreshReason.localizedRefreshReason) .talerFont(.title) let input = details.refreshInputAmount - AmountRowV(title: minimalistic ? "Refreshed:" : "Refreshed amount:", + AmountRowV(stack: stack.push(), + title: minimalistic ? "Refreshed:" : "Refreshed amount:", amount: input, isNegative: false, color: labelColor, large: true) if let fee = refreshFee(input: input, output: details.refreshOutputAmount) { - AmountRowV(title: minimalistic ? "Fee:" : "Refreshed fee:", + AmountRowV(stack: stack.push(), + title: minimalistic ? "Fee:" : "Refreshed fee:", amount: fee, isNegative: !fee.isZero, color: labelColor, @@ -425,7 +427,6 @@ struct TransactionSummaryV: View { baseURL: nil, noFees: nil, large: true, // TODO: baseURL, noFees summary: nil, merchant: nil) - } case .denomLoss(let denomLossTransaction): Group { let details = denomLossTransaction.details // TODO: more details