[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 09/25: Logger
From: |
gnunet |
Subject: |
[taler-taler-ios] 09/25: Logger |
Date: |
Mon, 06 Nov 2023 20:40:16 +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 370cbefa59dc6e18fa7022e2e671b3a9eb2ab8c5
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Nov 4 07:57:58 2023 +0100
Logger
---
TalerWallet1/Backend/WalletCore.swift | 5 +++++
TalerWallet1/Controllers/TalerWallet1App.swift | 4 ++--
TalerWallet1/Views/Main/MainView.swift | 7 +++++--
TalerWallet1/Views/Transactions/TransactionDetailView.swift | 9 +++++----
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/TalerWallet1/Backend/WalletCore.swift
b/TalerWallet1/Backend/WalletCore.swift
index 8fd3c18..e9e9ef1 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -190,14 +190,19 @@ extension WalletCore {
if let type = TransactionType(rawValue: components[1]) {
guard type != .refresh else { return }
if decoded.newTxState.major == .done {
+ logger.log("Done: \(decoded.transactionId,
privacy: .private(mask: .hash))")
Controller.shared.playSound(type.isIncoming ? 2 :
1)
} else if decoded.newTxState.major == .expired {
+ logger.log("Expired: \(decoded.transactionId,
privacy: .private(mask: .hash))")
Controller.shared.playSound(0)
}
postNotification(.TransactionStateTransition,
userInfo: [TRANSACTIONTRANSITION:
decoded])
}
}
+ } else {
+ // TODO: Same state usually means that an error is transmitted
+ logger.log("No State change: \(decoded.transactionId, privacy:
.private(mask: .hash))")
}
} catch { // rethrows
symLog.log(jsonData) // TODO: .error
diff --git a/TalerWallet1/Controllers/TalerWallet1App.swift
b/TalerWallet1/Controllers/TalerWallet1App.swift
index 7f7fa50..9efb5be 100644
--- a/TalerWallet1/Controllers/TalerWallet1App.swift
+++ b/TalerWallet1/Controllers/TalerWallet1App.swift
@@ -10,8 +10,8 @@
*/
import BackgroundTasks
import SwiftUI
-import SymLog
import os.log
+import SymLog
@main
struct TalerWallet1App: App {
@@ -37,7 +37,7 @@ struct TalerWallet1App: App {
var body: some Scene {
WindowGroup {
- MainView(stack: CallStack("App"), soundPlayed: $soundPlayed)
+ MainView(logger: logger, stack: CallStack("App"), soundPlayed:
$soundPlayed)
.environmentObject(debugViewC) // change viewID / sheetID
.environmentObject(viewState) // popToRoot
.environmentObject(controller)
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 4a5e73b..56b166e 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -3,6 +3,7 @@
* See LICENSE.md
*/
import SwiftUI
+import os.log
import SymLog
// Use this to delay instantiation when using `NavigationLink`, etc...
@@ -15,6 +16,7 @@ struct LazyView<Content: View>: View {
struct MainView: View {
private let symLog = SymLogV(0)
+ let logger: Logger
let stack: CallStack
@EnvironmentObject private var viewState: ViewState //
popToRootView()
@EnvironmentObject private var controller: Controller
@@ -33,7 +35,7 @@ struct MainView: View {
#endif
Group {
if controller.backendState == .ready {
- Content(symLog: symLog, stack: stack.push("Content"),
talerFont: $talerFont)
+ Content(symLog: symLog, logger: logger, stack:
stack.push("Content"), talerFont: $talerFont)
// any change to rootViewId triggers popToRootView behaviour
.id(viewState.rootViewId)
.onAppear() {
@@ -74,6 +76,7 @@ enum Tab {
extension MainView {
struct Content: View {
let symLog: SymLogV?
+ let logger: Logger
let stack: CallStack
@State private var shouldReloadBalances = 0
@State private var balances: [Balance] = []
@@ -220,7 +223,7 @@ extension MainView {
}
.onNotification(.BalanceChange) { notification in
// reload balances on receiving BalanceChange notification ...
- symLog?.log(".onNotification(.BalanceChange) ==> reload")
+ logger.info(".onNotification(.BalanceChange) ==> reload")
shouldReloadBalances += 1
}
.onChange(of: balances) { newArray in
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index 440818c..a4ad34f 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -121,20 +121,21 @@ struct TransactionDetailView: View {
}
}.onNotification(.TransactionStateTransition) { notification in
if let transition = notification.userInfo?[TRANSACTIONTRANSITION]
as? TransactionTransition {
- if transition.transactionId == common.transactionId {
+ if transition.transactionId == common.transactionId { //
is the transition for THIS transaction?
let newMajor = transition.newTxState.major
let newMinor = transition.newTxState.minor
if let doneAction {
if newMajor == .done {
symLog.log("newTxState.major == done => dismiss
sheet")
+// TODO: logger.info("newTxState.major == done =>
dismiss sheet")
doneAction() // if this view is in a sheet
this action will dissmiss it
} else if newMajor == .expired {
symLog.log("newTxState.major == expired =>
dismiss sheet")
+// TODO: logger.info("newTxState.major == expired
=> dismiss sheet")
doneAction() // if this view is in a sheet
this action will dissmiss it
} else if newMajor == .pending {
if let newMinor {
if newMinor == .exchangeWaitReserve { // user
did confirm on bank website
-// symLog.log("newTxState.minor ==
exchangeWaitReserve => change Buttons")
symLog.log("newTxState.minor ==
exchangeWaitReserve => dismiss sheet")
doneAction() // if this view is in
a sheet this action will dissmiss it
} else if newMinor == .withdrawCoins { //
coin-withdrawal has started
@@ -158,8 +159,8 @@ struct TransactionDetailView: View {
symLog.log(error.localizedDescription)
}}}
}
- } else {
- // Yikes - should never happen
+ } else { // Yikes - should never happen
+// TODO: logger.warning("Can't get notification.userInfo as
TransactionTransition")
symLog.log(notification.userInfo as Any)
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 04/25: No l10n for Debug, (continued)
- [taler-taler-ios] 04/25: No l10n for Debug, gnunet, 2023/11/06
- [taler-taler-ios] 13/25: Accessibility, gnunet, 2023/11/06
- [taler-taler-ios] 24/25: Accessibility: Contrast, gnunet, 2023/11/06
- [taler-taler-ios] 18/25: Default for Sound & Haptics ON, gnunet, 2023/11/06
- [taler-taler-ios] 23/25: L10N, EMPTYSTRING, gnunet, 2023/11/06
- [taler-taler-ios] 10/25: Use System Alert for iOS16+, gnunet, 2023/11/06
- [taler-taler-ios] 14/25: Blue Logo, gnunet, 2023/11/06
- [taler-taler-ios] 25/25: Bump version to 0.9.3 (24), gnunet, 2023/11/06
- [taler-taler-ios] 15/25: cleanup sortedTransactions, gnunet, 2023/11/06
- [taler-taler-ios] 07/25: IncompleteRowV, gnunet, 2023/11/06
- [taler-taler-ios] 09/25: Logger,
gnunet <=
- [taler-taler-ios] 19/25: SendDone: Prevent double execution, gnunet, 2023/11/06
- [taler-taler-ios] 20/25: Debugging, gnunet, 2023/11/06
- [taler-taler-ios] 12/25: KYC - wip, gnunet, 2023/11/06
- [taler-taler-ios] 08/25: Accessibility, gnunet, 2023/11/06
- [taler-taler-ios] 17/25: ThreeAmountsV cleanup, gnunet, 2023/11/06
- [taler-taler-ios] 11/25: cleanup, gnunet, 2023/11/06
- [taler-taler-ios] 22/25: Announce, gnunet, 2023/11/06