commit e4c17bc62139bc107417b55f58af642e09a912c5 parent 8b3ce5531cb69b4dc897bf5c226a8ab2a7830a43 Author: Marc Stibane <marc@taler.net> Date: Sat, 28 Sep 2024 08:25:26 +0200 strikethrough Diffstat:
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalanceCellV.swift b/TalerWallet1/Views/Balances/BalanceCellV.swift @@ -28,6 +28,7 @@ struct BalanceCellV: View { currencyInfo: $currencyInfo, amount: amount, isNegative: nil, // don't show the + sign + strikethrough: false, large: true) .foregroundColor(.primary) let hLayout = amountV diff --git a/TalerWallet1/Views/HelperViews/AmountRowV.swift b/TalerWallet1/Views/HelperViews/AmountRowV.swift @@ -26,6 +26,7 @@ struct AmountRowV: View { currencyInfo: $currencyInfo, amount: amount, isNegative: isNegative, + strikethrough: false, large: large) .foregroundColor(color) let verticalV = VStack(alignment: .leading) { diff --git a/TalerWallet1/Views/HelperViews/AmountV.swift b/TalerWallet1/Views/HelperViews/AmountV.swift @@ -12,7 +12,8 @@ struct AmountV: View { let stack: CallStack? @Binding var currencyInfo: CurrencyInfo let amount: Amount - let isNegative: Bool? // if true, show a "-" before the amount + let isNegative: Bool? // if true, show a "-" before the amount + let strikethrough: Bool let large: Bool // set to false for QR or IBAN @EnvironmentObject private var controller: Controller @@ -25,6 +26,7 @@ struct AmountV: View { : showSign ? "- \(amountFormatted)" : "+ \(amountFormatted)" Text(amountStr) + .strikethrough(strikethrough, color: .red) .multilineTextAlignment(.center) .talerFont(large ? .title : .title2) // .fontWeight(large ? .medium : .regular) // @available(iOS 16.0, *) @@ -38,6 +40,15 @@ extension AmountV { self._currencyInfo = currencyInfo self.amount = amount self.isNegative = isNegative + self.strikethrough = false + self.large = false + } + init(_ currencyInfo: Binding<CurrencyInfo>, _ amount: Amount, isNegative: Bool?, strikethrough: Bool) { + self.stack = nil + self._currencyInfo = currencyInfo + self.amount = amount + self.isNegative = isNegative + self.strikethrough = strikethrough self.large = false } } diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -56,7 +56,8 @@ struct TransactionRowView: View { let iconBadge = TransactionIconBadge(type: common.type, foreColor: foreColor, done: done, incoming: incoming, shouldConfirm: shouldConfirm, needsKYC: needsKYC) - let amountV = AmountV($currencyInfo, common.amountEffective, isNegative: isZero ? nil : !incoming) + let amountV = AmountV($currencyInfo, isZero ? common.amountRaw : common.amountEffective, + isNegative: isZero ? nil : !incoming, strikethrough: !doneOrPending) .foregroundColor(foreColor) let topString = topString()