gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 111/204: exchange


From: gnunet
Subject: [taler-taler-ios] 111/204: exchange
Date: Thu, 05 Dec 2024 23:51:19 +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 d0118d3b16b8d5a3d2bda2c031f68aaf8cae0e20
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Nov 8 20:26:17 2024 +0100

    exchange
---
 TalerWallet1/Controllers/Controller.swift               |  7 ++++---
 TalerWallet1/Model/Model+Exchange.swift                 | 17 ++++++++---------
 TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift |  1 +
 .../Views/Actions/Peer2peer/RequestPayment.swift        |  1 +
 .../Views/Settings/Exchange/ExchangeListView.swift      |  1 +
 .../Views/Settings/Exchange/ExchangeSectionView.swift   |  7 ++++++-
 .../Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift     |  1 +
 TalerWallet1/Views/Sheets/Payment/PaymentView.swift     |  2 +-
 .../WithdrawBankIntegrated/WithdrawAcceptView.swift     |  1 +
 .../Sheets/WithdrawBankIntegrated/WithdrawURIView.swift |  1 +
 TalerWallet1/Views/Sheets/WithdrawExchangeV.swift       |  1 +
 11 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/TalerWallet1/Controllers/Controller.swift 
b/TalerWallet1/Controllers/Controller.swift
index e64c71d..3674519 100755
--- a/TalerWallet1/Controllers/Controller.swift
+++ b/TalerWallet1/Controllers/Controller.swift
@@ -181,7 +181,7 @@ class Controller: ObservableObject {
         return false
     }
 
-//    @MainActor
+    @MainActor
     func exchange(for baseUrl: String?, model: WalletModel) async -> Exchange? 
{
         if let baseUrl {
             if let exchange1 = exchange(for: baseUrl) {
@@ -196,8 +196,9 @@ class Controller: ObservableObject {
         return nil
     }
 
+    @MainActor
     func updateInfo(_ scope: ScopeInfo, model: WalletModel) async {
-        if let info = try? await model.getCurrencyInfoM(scope: scope) {
+        if let info = try? await model.getCurrencyInfo(scope: scope) {
             await setInfo(info, for: scope)
 //            logger.log("  ❗️info set for \(scope.currency)")
         }
@@ -233,7 +234,7 @@ class Controller: ObservableObject {
         if let info = info(for: scope) {
             return info
         }
-        let info = try await model.getCurrencyInfoM(scope: scope, delay: 0)
+        let info = try await model.getCurrencyInfo(scope: scope, delay: 0)
         await setInfo(info, for: scope)
         return info
     }
diff --git a/TalerWallet1/Model/Model+Exchange.swift 
b/TalerWallet1/Model/Model+Exchange.swift
index 702d603..15e32e3 100644
--- a/TalerWallet1/Model/Model+Exchange.swift
+++ b/TalerWallet1/Model/Model+Exchange.swift
@@ -173,7 +173,7 @@ fileprivate struct GetCurrencySpecification: 
WalletBackendFormattedRequest {
 // MARK: -
 extension WalletModel {
     /// ask wallet-core for its list of known exchanges
-    @MainActor func listExchangesM(scope: ScopeInfo?, filterByStatus: 
ExchangeEntryStatus? = nil, viewHandles: Bool = false)
+    nonisolated func listExchanges(scope: ScopeInfo?, filterByStatus: 
ExchangeEntryStatus? = nil, viewHandles: Bool = false)
       async -> [Exchange] {   // M for MainActor
         do {
             let request = ListExchanges(scope: scope, filterByStatus: 
filterByStatus)    // .used, .preset
@@ -185,7 +185,7 @@ extension WalletModel {
     }
 
     /// add a new exchange with URL to the wallet's list of known exchanges
-    func getExchangeByUrl(url: String, viewHandles: Bool = false)
+    nonisolated func getExchangeByUrl(url: String, viewHandles: Bool = false)
       async throws -> Exchange {
         let request = GetExchangeByUrl(exchangeBaseUrl: url)
 //            logger.info("query for exchange: \(url, privacy: .public)")
@@ -194,16 +194,16 @@ extension WalletModel {
     }
 
     /// add a new exchange with URL to the wallet's list of known exchanges
-    func addExchange(url: String, viewHandles: Bool = false)
-    async throws {
+    nonisolated func addExchange(url: String, viewHandles: Bool = false)
+      async throws {
         let request = AddExchange(exchangeBaseUrl: url)
         logger.info("adding exchange: \(url, privacy: .public)")
         _ = try await sendRequest(request, viewHandles: viewHandles)
     }
 
     /// add a new exchange with URL to the wallet's list of known exchanges
-    func deleteExchange(url: String, purge: Bool = false, viewHandles: Bool = 
false)
-    async throws {
+    nonisolated func deleteExchange(url: String, purge: Bool = false, 
viewHandles: Bool = false)
+      async throws {
         let request = DeleteExchange(exchangeBaseUrl: url, purge: purge)
         logger.info("deleting exchange: \(url, privacy: .public)")
         _ = try await sendRequest(request, viewHandles: viewHandles)
@@ -212,7 +212,7 @@ extension WalletModel {
     /// ask wallet-core to update an existing exchange by querying it for 
denominations, fees, and scoped currency info
 //    func updateExchange(scopeInfo: ScopeInfo)
 //    func updateExchange(scopeInfo: ScopeInfo, viewHandles: Bool = false)
-    func updateExchange(exchangeBaseUrl: String, viewHandles: Bool = false)
+    nonisolated func updateExchange4711(exchangeBaseUrl: String, viewHandles: 
Bool = false)
       async throws  {
 //        let request = UpdateExchange(scopeInfo: scopeInfo)
         let request = UpdateExchange(exchangeBaseUrl: exchangeBaseUrl)
@@ -221,8 +221,7 @@ extension WalletModel {
         _ = try await sendRequest(request, viewHandles: viewHandles)
     }
 
-    @MainActor
-    func getCurrencyInfoM(scope: ScopeInfo, delay: UInt = 0, viewHandles: Bool 
= false)
+    nonisolated func getCurrencyInfo(scope: ScopeInfo, delay: UInt = 0, 
viewHandles: Bool = false)
       async throws -> CurrencyInfo {
         let request = GetCurrencySpecification(scope: scope)
         let response = try await sendRequest(request, ASYNCDELAY + delay, 
viewHandles: viewHandles)
diff --git a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift 
b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
index 7310636..bbbb58e 100644
--- a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift
@@ -160,6 +160,7 @@ struct ManualWithdrawContent: View {
         return nil
     } // computeFee
 
+    @MainActor
     private func viewDidLoad2() async {
         // neues scope wenn balance geändert wird?
         let details = try? await 
model.getWithdrawalDetailsForAmountM(amountToTransfer, baseUrl: nil, scope: 
scope,
diff --git a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift 
b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
index b0645e1..ede03f7 100644
--- a/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Actions/Peer2peer/RequestPayment.swift
@@ -144,6 +144,7 @@ struct RequestPaymentContent: View {
         return peerPullCheck != nil ? true : false
     }
 
+    @MainActor
     private func computeFee(_ amount: Amount) async -> ComputeFeeResult? {
         if exchange == nil {
             if let url = scopeInfo.url {
diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift 
b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
index 32e7d0b..c59a983 100644
--- a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
@@ -20,6 +20,7 @@ struct ExchangeListView: View {
     @State var showAlert: Bool = false
     @State var newExchange: String = TESTEXCHANGE
 
+    @MainActor
     func addExchange(_ exchange: String) -> Void {
         Task { // runs on MainActor
             symLog.log("adding: \(exchange)")
diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift 
b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
index 1ea3fb9..a431b94 100755
--- a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
@@ -46,15 +46,20 @@ struct ExchangeSectionView: View {
 //        return nil
 //    }
 
+    @MainActor
     private func viewDidLoad() async {
-        if let exc = try? await model.listExchangesM(scope: balance.scopeInfo) 
{
+        if let exc = try? await model.listExchanges(scope: balance.scopeInfo) {
             withAnimation { exchanges = exc }
         }
     }
+
+    @MainActor
     private func currencyTickerChanged(_ scopeInfo: ScopeInfo) async {
         symLog.log("task \(didDelete ? 1 : 0)")
         currencyInfo = controller.info(for: scopeInfo, 
controller.currencyTicker)
     }
+
+    @MainActor
     private func deleteExchange() {
         disabled = true     // don't try this more than once
         Task { // runs on MainActor
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift 
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
index 74d191c..8e3a32e 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -28,6 +28,7 @@ struct P2pReceiveURIView: View {
 
     let navTitle = String(localized: "P2P Receive")
 
+    @MainActor
     private func viewDidLoad() async {
         symLog.log(".task")
         if let ppResponse = try? await 
model.preparePeerPushCreditM(url.absoluteString) {
diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift 
b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
index 4366e1c..8534d52 100644
--- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
@@ -88,7 +88,7 @@ struct PaymentView: View, Sendable {
     @State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
     @State var preparePayResult: PreparePayResult? = nil
 
-
+    @MainActor
     func checkCurrencyInfo(for result: PreparePayResult) async {
         let scopes = result.scopes
         if scopes.count > 0 {
diff --git 
a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift 
b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift
index 1957b74..8b2c932 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift
@@ -28,6 +28,7 @@ struct WithdrawAcceptView: View {
     @State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
     @State private var withdrawalDetails: WithdrawalDetailsForAmount? = nil
 
+    @MainActor
     func reloadExchange() async -> Void {        // TODO: throws?
         if let exchange {
             if let someExchange = try? await model.getExchangeByUrl(url: 
exchange.exchangeBaseUrl) {
diff --git 
a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift 
b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
index 6927ca1..f49dc24 100755
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -47,6 +47,7 @@ struct WithdrawURIView: View {
 
     let navTitle = String(localized: "Withdrawal")
 
+    @MainActor
     func loadExchange(_ baseUrl: String) async {        // TODO: throws?
         if let someExchange = try? await model.getExchangeByUrl(url: baseUrl) {
             symLog.log("Loaded \(baseUrl.trimURL)")
diff --git a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift 
b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
index 55bd32d..a2de9e8 100644
--- a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift
@@ -25,6 +25,7 @@ struct WithdrawExchangeV: View {
 
     let navTitle = String(localized: "Checking Link")
 
+    @MainActor
     private func viewDidLoad() async {
         if exchange == nil {
             symLog.log(".task")

-- 
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]