summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-08-08 12:18:26 +0200
committerMarc Stibane <marc@taler.net>2023-08-08 12:18:26 +0200
commitbf9bfba90aed389a0ff802b861a3c0dc5882518b (patch)
tree1a71f72893489bf2f568ee52dc6cf513474be8b4
parent949faafeaefa0ed08545b7315aec6309919594c3 (diff)
downloadtaler-ios-bf9bfba90aed389a0ff802b861a3c0dc5882518b.tar.gz
taler-ios-bf9bfba90aed389a0ff802b861a3c0dc5882518b.tar.bz2
taler-ios-bf9bfba90aed389a0ff802b861a3c0dc5882518b.zip
Wallet changes + bugfixes
-rw-r--r--TalerWallet1/Backend/WalletBackendRequest.swift13
-rw-r--r--TalerWallet1/Backend/WalletCore.swift2
-rw-r--r--TalerWallet1/Model/WalletModel.swift2
-rw-r--r--TalerWallet1/Views/Exchange/ManualWithdraw.swift2
4 files changed, 10 insertions, 9 deletions
diff --git a/TalerWallet1/Backend/WalletBackendRequest.swift b/TalerWallet1/Backend/WalletBackendRequest.swift
index 9bf8d80..ec9d2ca 100644
--- a/TalerWallet1/Backend/WalletBackendRequest.swift
+++ b/TalerWallet1/Backend/WalletBackendRequest.swift
@@ -28,18 +28,19 @@ struct ScopeInfo: Codable, Hashable {
enum ScopeInfoType: String, Codable {
case global
case exchange
+ case auditor
}
var type: ScopeInfoType
- var exchangeBaseUrl: String? // only for "exchange"
+ var url: String? // only for "exchange"
var currency: String
public static func == (lhs: ScopeInfo, rhs: ScopeInfo) -> Bool {
- if let lhsBaseURL = lhs.exchangeBaseUrl {
- if let rhsBaseURL = rhs.exchangeBaseUrl {
+ if let lhsBaseURL = lhs.url {
+ if let rhsBaseURL = rhs.url {
if lhsBaseURL != rhsBaseURL { return false } // different exchanges
// else fall thru and check type & currency
} else { return false } // left but not right
- } else if rhs.exchangeBaseUrl != nil {
+ } else if rhs.url != nil {
return false // right but not left
}
return lhs.type == rhs.type &&
@@ -47,8 +48,8 @@ struct ScopeInfo: Codable, Hashable {
}
public func hash(into hasher: inout Hasher) {
hasher.combine(type)
- if let baseURL = exchangeBaseUrl {
- hasher.combine(baseURL)
+ if let url {
+ hasher.combine(url)
}
hasher.combine(currency)
}
diff --git a/TalerWallet1/Backend/WalletCore.swift b/TalerWallet1/Backend/WalletCore.swift
index 3def60d..f2f0460 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -186,7 +186,7 @@ extension WalletCore {
do {
let decoded = try JSONDecoder().decode(TransactionTransition.self, from: jsonData)
if decoded.newTxState != decoded.oldTxState {
- let components = decoded.transactionId.components(separatedBy: [":"])
+ let components = decoded.transactionId.components(separatedBy: ":")
if components.count >= 3 { // txn:$txtype:$uid
if let type = TransactionType(rawValue: components[1]) {
guard type != .refresh else { return }
diff --git a/TalerWallet1/Model/WalletModel.swift b/TalerWallet1/Model/WalletModel.swift
index 1de0aff..d5dc714 100644
--- a/TalerWallet1/Model/WalletModel.swift
+++ b/TalerWallet1/Model/WalletModel.swift
@@ -69,7 +69,7 @@ fileprivate struct GetTransactionById: WalletBackendFormattedRequest {
// MARK: -
/// The info returned from Wallet-core init
struct VersionInfo: Decodable {
- var hash: String
+ var hash: String?
var version: String
var exchange: String
var merchant: String
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
index 6077474..5486073 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -25,7 +25,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!
+ let currency = exchange.currency ?? String(localized: "Unknown", comment: "unknown currency")
let navTitle = String(localized: "Withdraw \(currency)")
let currencyField = CurrencyField(value: $centsToTransfer, currency: currency) // becomeFirstResponder
// let agePicker = AgePicker(ageMenuList: $ageMenuList, selectedAge: $selectedAge)