gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 18/30: cleanup


From: gnunet
Subject: [taler-taler-ios] 18/30: cleanup
Date: Sun, 19 Nov 2023 23:53:42 +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 a9f37010a880fd2291ff300491bd35abc6afc78d
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Nov 19 13:24:12 2023 +0100

    cleanup
---
 TalerWallet1/Backend/WalletCore.swift              | 31 +++++++++++++---------
 TalerWallet1/Model/Model+Exchange.swift            | 18 -------------
 TalerWallet1/Model/Model+Withdraw.swift            |  4 +--
 TalerWallet1/Model/WalletModel.swift               |  6 +++--
 TalerWallet1/Views/Balances/BalanceRowView.swift   |  3 ++-
 TalerWallet1/Views/Balances/TwoRowButtons.swift    |  2 +-
 TalerWallet1/Views/Exchange/ManualWithdraw.swift   |  2 +-
 TalerWallet1/Views/HelperViews/Buttons.swift       |  1 +
 .../Views/Transactions/TransactionDetailView.swift | 18 ++++++-------
 9 files changed, 38 insertions(+), 47 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift 
b/TalerWallet1/Backend/WalletCore.swift
index f2f53cd..8c8ebde 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -197,31 +197,36 @@ extension WalletCore {
                         case .done:
                             logger.info("Done: \(decoded.transactionId, 
privacy: .private(mask: .hash))")
                             Controller.shared.playSound(type.isIncoming ? 2 : 
1)
-                            postNotification(.TransactionDone,
-                                             userInfo: [TRANSACTIONTRANSITION: 
decoded])
+                            postNotification(.TransactionDone, userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                            return
                         case .expired:
                             logger.log("Expired: \(decoded.transactionId, 
privacy: .private(mask: .hash))")
                             Controller.shared.playSound(0)
-                            postNotification(.TransactionExpired,
-                                             userInfo: [TRANSACTIONTRANSITION: 
decoded])
+                            postNotification(.TransactionExpired, userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                            return
                         case .pending:
                             if let newMinor = decoded.newTxState.minor {
                                 if newMinor == .ready {
-                                    postNotification(.PendingReady,
-                                                     userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    logger.log("PendingReady: 
\(decoded.transactionId, privacy: .private(mask: .hash))")
+                                    postNotification(.PendingReady, userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    return
                                 } else if newMinor == .exchangeWaitReserve     
 // user did confirm on bank website
                                        || newMinor == .withdrawCoins {         
 // coin-withdrawal has started
-                                    postNotification(.DismissSheet,
-                                                     userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    logger.log("DismissSheet: 
\(decoded.transactionId, privacy: .private(mask: .hash))")
+                                    postNotification(.DismissSheet, userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    return
                                 } else if newMinor == .kyc {       // user did 
confirm on bank website, but KYC is needed
-                                    postNotification(.KYCrequired,
-                                                     userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    logger.log("KYCrequired: 
\(decoded.transactionId, privacy: .private(mask: .hash))")
+                                    postNotification(.KYCrequired, userInfo: 
[TRANSACTIONTRANSITION: decoded])
+                                    return
                                 }
                             }
-                        default: break
+                            logger.log("Pending: \(decoded.transactionId, 
privacy: .private(mask: .hash))")
+                            postNotification(.TransactionStateTransition, 
userInfo: [TRANSACTIONTRANSITION: decoded])
+                        default:
+                            logger.log("Yikes: \(decoded.transactionId, 
privacy: .private(mask: .hash))")
+                            postNotification(.TransactionStateTransition, 
userInfo: [TRANSACTIONTRANSITION: decoded])
                     } // switch
-                    postNotification(.TransactionStateTransition,
-                                     userInfo: [TRANSACTIONTRANSITION: 
decoded])
                 } // type
             } // 3 components
         } catch {       // rethrows
diff --git a/TalerWallet1/Model/Model+Exchange.swift 
b/TalerWallet1/Model/Model+Exchange.swift
index 032ab24..46aeb6c 100644
--- a/TalerWallet1/Model/Model+Exchange.swift
+++ b/TalerWallet1/Model/Model+Exchange.swift
@@ -61,24 +61,6 @@ struct Exchange: Codable, Hashable, Identifiable {
     }
 }
 
-struct ExchangeListItem: Codable, Hashable {
-    var exchangeBaseUrl: String
-    var currency: String
-    var paytoUris: [String]
-
-    public static func == (lhs: ExchangeListItem, rhs: ExchangeListItem) -> 
Bool {
-        return lhs.exchangeBaseUrl == rhs.exchangeBaseUrl &&
-        lhs.currency == rhs.currency &&
-        lhs.paytoUris == rhs.paytoUris
-    }
-
-    public func hash(into hasher: inout Hasher) {
-        hasher.combine(exchangeBaseUrl)
-        hasher.combine(currency)
-        hasher.combine(paytoUris)
-    }
-}
-
 struct ExchangeUrlItem: Codable, Hashable, Identifiable {
     var exchangeBaseUrl: String
     var id: String { exchangeBaseUrl }
diff --git a/TalerWallet1/Model/Model+Withdraw.swift 
b/TalerWallet1/Model/Model+Withdraw.swift
index 5b5fe8f..e86f394 100644
--- a/TalerWallet1/Model/Model+Withdraw.swift
+++ b/TalerWallet1/Model/Model+Withdraw.swift
@@ -11,8 +11,8 @@ fileprivate let ASYNCDELAY: UInt = 0   //set e.g to 6 or 9 
seconds for debugging
 /// The result from getWithdrawalDetailsForUri
 struct WithdrawUriInfoResponse: Decodable {
     var amount: Amount
-    var defaultExchangeBaseUrl: String?             // TODO: might be nil 
❗️Yikes
-    var possibleExchanges: [ExchangeListItem]       // TODO: query these for 
fees?
+    var defaultExchangeBaseUrl: String?
+    var possibleExchanges: [Exchange]       // TODO: query these for fees?
 }
 /// A request to get an exchange's withdrawal details.
 fileprivate struct GetWithdrawalDetailsForURI: WalletBackendFormattedRequest {
diff --git a/TalerWallet1/Model/WalletModel.swift 
b/TalerWallet1/Model/WalletModel.swift
index 588003b..428af7e 100644
--- a/TalerWallet1/Model/WalletModel.swift
+++ b/TalerWallet1/Model/WalletModel.swift
@@ -122,8 +122,9 @@ extension WalletModel {
     }
 
     private func docPath (sqlite3: Bool) throws -> String {
-        if let documentsUrl = FileManager.default.urls(for: 
.documentDirectory, in: .userDomainMask).first {
-            let documentUrl = documentsUrl.appendingPathComponent(DATABASE, 
isDirectory: false)
+//        if let documentsDir = FileManager.default.urls(for: 
.applicationSupportDirectory, in: .userDomainMask).first {
+        if let documentsDir = FileManager.default.urls(for: 
.documentDirectory, in: .userDomainMask).first {
+            let documentUrl = documentsDir.appendingPathComponent(DATABASE, 
isDirectory: false)
                                           .appendingPathExtension(sqlite3 ? 
"sqlite3" : "json")
             let docPath = documentUrl.path
             logger.debug("\(docPath)")
@@ -174,3 +175,4 @@ extension WalletModel {
         _ = try await sendRequest(request, 0)
     }
 }
+// MARK: -
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift 
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index 1c78853..241c503 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -10,8 +10,8 @@ struct BalanceButton: View {
     let sizeCategory: ContentSizeCategory
     let rowAction: () -> Void
 
-    @AppStorage("iconOnly") var iconOnly: Bool = false
     @Environment(\.colorSchemeContrast) private var colorSchemeContrast
+    @AppStorage("iconOnly") var iconOnly: Bool = false
 //    @AppStorage("moreContrast") var moreContrast: Bool = false
 
     var body: some View {
@@ -51,6 +51,7 @@ struct BalanceRowView: View {
     let sendAction: () -> Void
     let recvAction: () -> Void
     let rowAction: () -> Void
+
     @Environment(\.sizeCategory) var sizeCategory
     @EnvironmentObject private var controller: Controller
     @AppStorage("iconOnly") var iconOnly: Bool = false
diff --git a/TalerWallet1/Views/Balances/TwoRowButtons.swift 
b/TalerWallet1/Views/Balances/TwoRowButtons.swift
index 019b304..20d87c8 100644
--- a/TalerWallet1/Views/Balances/TwoRowButtons.swift
+++ b/TalerWallet1/Views/Balances/TwoRowButtons.swift
@@ -25,8 +25,8 @@ struct TwoRowButtons: View {
     let sendDisabled: Bool
     let sendAction: () -> Void
     let recvAction: () -> Void
+
     @Environment(\.sizeCategory) var sizeCategory
-    
 
     var body: some View {
         Group {
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift 
b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
index 6b17785..36f0aaf 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -26,7 +26,7 @@ struct ManualWithdraw: View {
         let _ = Self._printChanges()
         let _ = symLog.vlog()       // just to get the # to compare it with 
.onAppear & onDisappear
 #endif
-        let currency = exchange.currency ?? String(localized: "Unknown", 
comment: "unknown currency")
+        let currency = exchange.scopeInfo?.currency ?? exchange.currency ?? 
String(localized: "Unknown", comment: "unknown currency")
         let navTitle = String(localized: "NavTitle_Withdraw (currency)", 
defaultValue: "Withdraw \(currency)")
 //        let agePicker = AgePicker(ageMenuList: $ageMenuList, selectedAge: 
$selectedAge)
 
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift 
b/TalerWallet1/Views/HelperViews/Buttons.swift
index f221ac6..3e3884c 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -107,6 +107,7 @@ struct TalerButtonStyle: ButtonStyle {
     var aligned: TextAlignment = .center
 
     public func makeBody(configuration: ButtonStyle.Configuration) -> some 
View {
+//        configuration.role = type == .prominent ? .primary : .normal         
 Only on macOS
             MyBigButton(//type: type,
                    foreColor: foreColor(type: type, pressed: 
configuration.isPressed),
                    backColor: backColor(type: type, pressed: 
configuration.isPressed),
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift 
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index 330f753..a715954 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -24,15 +24,6 @@ extension Transaction {             // for Dummys
 struct TransactionDetailView: View {
     private let symLog = SymLogV(0)
     let stack: CallStack
-    @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
-//    @AppStorage("moreContrast") var moreContrast: Bool = false
-#if DEBUG
-    @AppStorage("developerMode") var developerMode: Bool = true
-#else
-    @AppStorage("developerMode") var developerMode: Bool = false
-#endif
-    @Environment(\.colorSchemeContrast) private var colorSchemeContrast
-
     let transactionId: String
     let reloadAction: ((_ transactionId: String) async throws -> Transaction)
 
@@ -44,6 +35,15 @@ struct TransactionDetailView: View {
     let suspendAction: ((_ transactionId: String) async throws -> Void)?
     let resumeAction: ((_ transactionId: String) async throws -> Void)?
 
+    @Environment(\.colorSchemeContrast) private var colorSchemeContrast
+    @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
+//    @AppStorage("moreContrast") var moreContrast: Bool = false
+#if DEBUG
+    @AppStorage("developerMode") var developerMode: Bool = true
+#else
+    @AppStorage("developerMode") var developerMode: Bool = false
+#endif
+
     @State var transaction: Transaction = Transaction(dummyCurrency: 
DEMOCURRENCY)
     @State var viewId = UUID()
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]