[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 64/69: show minor in tx details
From: |
gnunet |
Subject: |
[taler-taler-ios] 64/69: show minor in tx details |
Date: |
Fri, 19 Jan 2024 09:02:37 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit ae7a063131582f96b70d6eb6e6dd4436581c767e
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Jan 19 08:38:16 2024 +0100
show minor in tx details
---
TalerWallet1/Backend/WalletCore.swift | 16 +++++++++++-----
.../Views/Transactions/TransactionDetailView.swift | 16 +++++-----------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift
b/TalerWallet1/Backend/WalletCore.swift
index fe0f135..f081aac 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -193,7 +193,9 @@ extension WalletCore {
if components.count >= 3 { // txn:$txtype:$uid
if let type = TransactionType(rawValue: components[1]) {
guard type != .refresh else { return }
- switch decoded.newTxState.major {
+ let newMajor = decoded.newTxState.major
+ let newMinor = decoded.newTxState.minor
+ switch newMajor {
case .done:
logger.info("Done: \(decoded.transactionId,
privacy: .private(mask: .hash))")
if type.isWithdrawal {
@@ -204,7 +206,7 @@ extension WalletCore {
postNotification(.TransactionDone, userInfo:
[TRANSACTIONTRANSITION: decoded])
return
case .aborting:
- if let newMinor = decoded.newTxState.minor {
+ if let newMinor {
if newMinor == .refreshExpired {
logger.warning("RefreshExpired:
\(decoded.transactionId, privacy: .private(mask: .hash))")
Controller.shared.playSound(0)
@@ -220,7 +222,7 @@ extension WalletCore {
postNotification(.TransactionExpired, userInfo:
[TRANSACTIONTRANSITION: decoded])
return
case .pending:
- if let newMinor = decoded.newTxState.minor {
+ if let newMinor {
if newMinor == .ready {
logger.log("PendingReady:
\(decoded.transactionId, privacy: .private(mask: .hash))")
postNotification(.PendingReady, userInfo:
[TRANSACTIONTRANSITION: decoded])
@@ -237,11 +239,15 @@ extension WalletCore {
}
logger.log("Pending:\(newMinor.rawValue,
privacy: .public) \(decoded.transactionId, privacy: .private(mask: .hash))")
} else {
- logger.log("Pending: \(decoded.transactionId,
privacy: .private(mask: .hash))")
+ logger.log("Pending: \(decoded.transactionId,
privacy: .private(mask: .hash))")
}
postNotification(.TransactionStateTransition,
userInfo: [TRANSACTIONTRANSITION: decoded])
default:
- logger.warning("Unknow transition:
\(decoded.transactionId, privacy: .private(mask: .hash))")
+ if let newMinor {
+ logger.warning("\(newMajor.rawValue, privacy:
.public):\(newMinor.rawValue, privacy: .public) \(decoded.transactionId,
privacy: .private(mask: .hash))")
+ } else {
+ logger.warning("\(newMajor.rawValue, privacy:
.public): \(decoded.transactionId, privacy: .private(mask: .hash))")
+ }
postNotification(.TransactionStateTransition,
userInfo: [TRANSACTIONTRANSITION: decoded])
} // switch
} // type
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index 4375754..162cfb7 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -45,15 +45,6 @@ struct TransactionDetailView: View {
@State var transaction: Transaction = Transaction(dummyCurrency:
DEMOCURRENCY)
@State var viewId = UUID()
- func accessibilityDate(_ date: Date?) -> String? {
- if let date {
- let formatted = date.formatted(date: .long, time: .shortened)
-// print(formatted)
- return formatted
- }
- return nil
- }
-
func loadTransaction() async {
do {
let reloadedTransaction = try await reloadAction(transactionId)
@@ -107,7 +98,7 @@ struct TransactionDetailView: View {
let pending = transaction.isPending
let locale = TalerDater.shared.locale
let (dateString, date) = TalerDater.dateString(from: common.timestamp)
- let accessibilityDate = accessibilityDate(date) ?? dateString
+ let accessibilityDate = TalerDater.accessibilityDate(date) ??
dateString
let navTitle2 = transaction.localizedType
VStack {
List {
@@ -127,13 +118,16 @@ struct TransactionDetailView: View {
.foregroundColor(colorSchemeContrast == .increased ?
.primary : .secondary)
.listRowSeparator(.hidden)
VStack(alignment: .trailing) {
+ let majorState = common.txState.major.localizedState
let minorState = common.txState.minor?.localizedState ??
nil
+ let state = transaction.isPending ? minorState ??
majorState
+ : majorState
HStack {
Text(verbatim: "|") // only reason for this
leading-aligned text is to get a nice full length listRowSeparator
.accessibilityHidden(true)
.foregroundColor(Color.clear)
Spacer()
- Text("Status: \(minorState ??
common.txState.major.localizedState)")
+ Text("Status: \(state)")
.multilineTextAlignment(.trailing)
}
} .listRowSeparator(.automatic)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 48/69: fix fractions, (continued)
- [taler-taler-ios] 48/69: fix fractions, gnunet, 2024/01/19
- [taler-taler-ios] 66/69: InterfaceOrientation, gnunet, 2024/01/19
- [taler-taler-ios] 41/69: AppIcon blue, gnunet, 2024/01/19
- [taler-taler-ios] 38/69: remove, gnunet, 2024/01/19
- [taler-taler-ios] 39/69: Bump version to 0.9.3 (34), gnunet, 2024/01/19
- [taler-taler-ios] 35/69: Markdown for ToS, gnunet, 2024/01/19
- [taler-taler-ios] 37/69: dbg+cleanup, gnunet, 2024/01/19
- [taler-taler-ios] 53/69: Summary no longer twice, gnunet, 2024/01/19
- [taler-taler-ios] 34/69: tintcolor (blue) for links, gnunet, 2024/01/19
- [taler-taler-ios] 57/69: use cent initializer, gnunet, 2024/01/19
- [taler-taler-ios] 64/69: show minor in tx details,
gnunet <=
- [taler-taler-ios] 47/69: single routine for rendering amounts, gnunet, 2024/01/19
- [taler-taler-ios] 44/69: payment_received only for withdrawals, gnunet, 2024/01/19