[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 04/07: Constants, cleanup
From: |
gnunet |
Subject: |
[taler-taler-ios] 04/07: Constants, cleanup |
Date: |
Wed, 22 Feb 2023 16:16:31 +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 a4069f8e5d21184172daa774f528334d5798fcd6
Author: Marc Stibane <marc@taler.net>
AuthorDate: Mon Feb 20 15:11:30 2023 +0100
Constants, cleanup
---
TalerWallet.xcodeproj/project.pbxproj | 4 ++++
TalerWallet1/Helper/PublicConstants.swift | 24 ++++++++++++++++++++++
TalerWallet1/Model/ExchangeTestModel.swift | 24 +++++++++++-----------
TalerWallet1/Views/Pending/PendingModel.swift | 4 ++--
.../Views/Transactions/TransactionsModel.swift | 8 --------
TalerWallet1/Views/Withdraw/WithdrawURIView.swift | 2 +-
6 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/TalerWallet.xcodeproj/project.pbxproj
b/TalerWallet.xcodeproj/project.pbxproj
index 4d986fe..972d2b6 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 4EA1ABBE29A3833A008821EA /* PublicConstants.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EA1ABBD29A3833A008821EA /*
PublicConstants.swift */; };
4EB094D629896CD20043A8A1 /* TalerWalletTests.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EB094D429896CD20043A8A1 /*
TalerWalletTests.swift */; };
4EB094D729896CD20043A8A1 /* WalletBackendTests.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EB094D529896CD20043A8A1 /*
WalletBackendTests.swift */; };
4EB094DC29896D030043A8A1 /* TalerWalletUITestsLaunchTests.swift
in Sources */ = {isa = PBXBuildFile; fileRef = 4EB094D929896D030043A8A1 /*
TalerWalletUITestsLaunchTests.swift */; };
@@ -97,6 +98,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 4EA1ABBD29A3833A008821EA /* PublicConstants.swift */ = {isa =
PBXFileReference; lastKnownFileType = sourcecode.swift; path =
PublicConstants.swift; sourceTree = "<group>"; };
4EB094D429896CD20043A8A1 /* TalerWalletTests.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= TalerWalletTests.swift; sourceTree = "<group>"; };
4EB094D529896CD20043A8A1 /* WalletBackendTests.swift */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift;
path = WalletBackendTests.swift; sourceTree = "<group>"; };
4EB094D929896D030043A8A1 /* TalerWalletUITestsLaunchTests.swift
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.swift; path = TalerWalletUITestsLaunchTests.swift; sourceTree =
"<group>"; };
@@ -234,6 +236,7 @@
4EB095062989CB7C0043A8A1 /* TalerDater.swift */,
4EB095072989CB7C0043A8A1 /* TalerStrings.swift
*/,
4EB095082989CB7C0043A8A1 /*
View+dismissTop.swift */,
+ 4EA1ABBD29A3833A008821EA /*
PublicConstants.swift */,
);
path = Helper;
sourceTree = "<group>";
@@ -588,6 +591,7 @@
4EB095562989CBFE0043A8A1 /*
TransactionsListView.swift in Sources */,
4EB0951F2989CBCB0043A8A1 /*
WalletBackendRequest.swift in Sources */,
4EB095572989CBFE0043A8A1 /*
TransactionRow.swift in Sources */,
+ 4EA1ABBE29A3833A008821EA /*
PublicConstants.swift in Sources */,
4EB0956B2989CBFE0043A8A1 /*
TextFieldAlert.swift in Sources */,
4EB0956C2989CBFE0043A8A1 /* AmountView.swift in
Sources */,
4EB095592989CBFE0043A8A1 /*
TransactionsModel.swift in Sources */,
diff --git a/TalerWallet1/Helper/PublicConstants.swift
b/TalerWallet1/Helper/PublicConstants.swift
new file mode 100644
index 0000000..01680a0
--- /dev/null
+++ b/TalerWallet1/Helper/PublicConstants.swift
@@ -0,0 +1,24 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2022 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+import Foundation
+
+public let EXCHANGEBASEURL = "exchangeBaseUrl"
+
+public let WITHDRAWAL = "withdrawal"
+public let PAYMENT = "payment"
+public let REFUND = "refund"
+public let TIP = "tip"
+public let REFRESH = "refresh"
diff --git a/TalerWallet1/Model/ExchangeTestModel.swift
b/TalerWallet1/Model/ExchangeTestModel.swift
index 13a29b3..98702d5 100644
--- a/TalerWallet1/Model/ExchangeTestModel.swift
+++ b/TalerWallet1/Model/ExchangeTestModel.swift
@@ -18,11 +18,11 @@ import taler_swift
import SymLog
fileprivate let ASYNCDELAY: UInt = 0 //set e.g to 6 or 9 seconds for
debugging
-fileprivate let EXCHANGEBASEURL = "https://exchange.demo.taler.net/"
-fileprivate let BANKBASEURL = "https://bank.demo.taler.net/"
-fileprivate let BANKACCESSAPIBASEURL =
"https://bank.demo.taler.net/demobanks/default/access-api/"
-fileprivate let MERCHANTBASEURL = "https://backend.demo.taler.net/"
-fileprivate let MERCHANTAUTHTOKEN = "secret-token:sandbox"
+fileprivate let DEMO_EXCHANGEBASEURL = "https://exchange.demo.taler.net/"
+fileprivate let DEMO_BANKBASEURL = "https://bank.demo.taler.net/"
+fileprivate let DEMO_BANKAPIBASEURL =
"https://bank.demo.taler.net/demobanks/default/access-api/"
+fileprivate let DEMO_MERCHANTBASEURL = "https://backend.demo.taler.net/"
+fileprivate let DEMO_MERCHANTAUTHTOKEN = "secret-token:sandbox"
// MARK: -
class ExchangeTestModel: WalletModel {
@@ -33,9 +33,9 @@ extension ExchangeTestModel {
do {
let amount = Amount(currency: "KUDOS", integer: 11, fraction: 0)
let request = WalletBackendWithdrawTestBalance(amount: amount,
- bankBaseUrl: BANKBASEURL,
- exchangeBaseUrl:
EXCHANGEBASEURL,
- bankAccessApiBaseUrl:
BANKACCESSAPIBASEURL)
+ bankBaseUrl:
DEMO_BANKBASEURL,
+ exchangeBaseUrl:
DEMO_EXCHANGEBASEURL,
+ bankAccessApiBaseUrl:
DEMO_BANKAPIBASEURL)
let response = try await sendRequest(request, ASYNCDELAY)
symLog?.log("received: \(response)")
} catch {
@@ -49,10 +49,10 @@ extension ExchangeTestModel {
let amountS = Amount(currency: "KUDOS", integer: 1, fraction: 0)
let request = WalletBackendRunIntegration(amountToWithdraw:
amountW,
amountToSpend:
amountS,
- bankBaseUrl:
BANKACCESSAPIBASEURL,
- exchangeBaseUrl:
EXCHANGEBASEURL,
- merchantBaseUrl:
MERCHANTBASEURL,
- merchantAuthToken:
MERCHANTAUTHTOKEN)
+ bankBaseUrl:
DEMO_BANKAPIBASEURL,
+ exchangeBaseUrl:
DEMO_EXCHANGEBASEURL,
+ merchantBaseUrl:
DEMO_MERCHANTBASEURL,
+ merchantAuthToken:
DEMO_MERCHANTAUTHTOKEN)
let response = try await sendRequest(request, ASYNCDELAY)
symLog?.log("received: \(response)")
} catch {
diff --git a/TalerWallet1/Views/Pending/PendingModel.swift
b/TalerWallet1/Views/Pending/PendingModel.swift
index cb88523..6b0e38e 100644
--- a/TalerWallet1/Views/Pending/PendingModel.swift
+++ b/TalerWallet1/Views/Pending/PendingModel.swift
@@ -56,7 +56,7 @@ struct PendingOperation: Codable, Hashable {
}
//let pending1 = ["type": "exchange-update",
-// "exchangeBaseUrl": "https://exchange.demo.taler.net/",
+// EXCHANGEBASEURL: "https://exchange.demo.taler.net/",
// "id": "exchange-update:https://exchange.demo.taler.net/",
// "timestampDue": ["t_ms": 1669931055000],
// "isDue": false,
@@ -64,7 +64,7 @@ struct PendingOperation: Codable, Hashable {
// "givesLifeness": false] as [String : Any]
//
//let pending2 = ["type": "exchange-check-refresh",
-// "exchangeBaseUrl": "https://exchange.demo.taler.net/",
+// EXCHANGEBASEURL: "https://exchange.demo.taler.net/",
// "id": "exchange-update:https://exchange.demo.taler.net/",
// "timestampDue": ["t_ms": 1670013862000],
// "isDue": false,
diff --git a/TalerWallet1/Views/Transactions/TransactionsModel.swift
b/TalerWallet1/Views/Transactions/TransactionsModel.swift
index 9786c1e..253a557 100644
--- a/TalerWallet1/Views/Transactions/TransactionsModel.swift
+++ b/TalerWallet1/Views/Transactions/TransactionsModel.swift
@@ -22,14 +22,6 @@ fileprivate let ASYNCDELAY: UInt = 0 //set e.g to 6 or 9
seconds for debugging
class TransactionsModel: WalletModel {
@Published var transactions: [Transaction]? // update view
}
-//extension Transaction {
-// func exchangeBaseUrl() -> String {
-// switch detail {
-// case .withdrawal(let transactionWithdrawal):
-// return transactionWithdrawal.exchangeBaseUrl
-// }
-// }
-//}
// MARK: -
/// A request to get the transactions in the wallet's history.
diff --git a/TalerWallet1/Views/Withdraw/WithdrawURIView.swift
b/TalerWallet1/Views/Withdraw/WithdrawURIView.swift
index 939c24d..e928e44 100644
--- a/TalerWallet1/Views/Withdraw/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Withdraw/WithdrawURIView.swift
@@ -66,7 +66,7 @@ struct WithdrawURIView: View {
symLog.log(".task")
detailsForUri = try await
viewModel.loadWithdrawalDetailsForURI(url.absoluteString)
let baseURL = detailsForUri!.defaultExchangeBaseUrl
- symLog.log("amount: \(detailsForUri!.amount), baseURL:
\(baseURL)")
+ symLog.log("amount: \(detailsForUri!.amount), baseURL:
\(String(describing: baseURL))")
// TODO: let user choose exchange from array
detailsForAmount = try await
viewModel.loadWithdrawalDetailsForAmount(detailsForUri!)
symLog.log("raw: \(detailsForAmount!.amountRaw), effective:
\(detailsForAmount!.amountEffective)")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (df4fe35 -> 4f2b20c), gnunet, 2023/02/22
- [taler-taler-ios] 01/07: Error handling, Amount.diff, gnunet, 2023/02/22
- [taler-taler-ios] 04/07: Constants, cleanup,
gnunet <=
- [taler-taler-ios] 03/07: added ext+taler and web+taler to the list of recognized URL schemes, gnunet, 2023/02/22
- [taler-taler-ios] 06/07: Info & SceneConfigurations, v0.9.2, bundleID, gnunet, 2023/02/22
- [taler-taler-ios] 02/07: ported remaining sync wallet-core funcs to try await, gnunet, 2023/02/22
- [taler-taler-ios] 05/07: Transaction definition and JSON decoding - Bug 7678, gnunet, 2023/02/22
- [taler-taler-ios] 07/07: Transaction list and details, gnunet, 2023/02/22