diff options
author | Marc Stibane <marc@taler.net> | 2024-04-05 21:48:52 +0200 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2024-04-05 21:48:52 +0200 |
commit | 5fb423da5709a492bd07479908f721736402314c (patch) | |
tree | f11910fc0fa945a62bbd5e2ec693d619ab9d6fbb | |
parent | 6dd8c3b196206bcf00d425e9bf518d2e599ce69d (diff) | |
download | taler-ios-5fb423da5709a492bd07479908f721736402314c.tar.gz taler-ios-5fb423da5709a492bd07479908f721736402314c.tar.bz2 taler-ios-5fb423da5709a492bd07479908f721736402314c.zip |
flags, includeRefreshes, make error parts optional
-rw-r--r-- | TalerWallet1/Model/Model+Transactions.swift | 9 | ||||
-rw-r--r-- | TalerWallet1/Model/Transaction.swift | 5 | ||||
-rw-r--r-- | TalerWallet1/Model/WalletModel.swift | 14 |
3 files changed, 23 insertions, 5 deletions
diff --git a/TalerWallet1/Model/Model+Transactions.swift b/TalerWallet1/Model/Model+Transactions.swift index 3b91b7a..26288bf 100644 --- a/TalerWallet1/Model/Model+Transactions.swift +++ b/TalerWallet1/Model/Model+Transactions.swift @@ -26,17 +26,19 @@ extension WalletModel { fileprivate struct GetTransactions: WalletBackendFormattedRequest { func operation() -> String { "getTransactions" } // func operation() -> String { "testingGetSampleTransactions" } - func args() -> Args { Args(scopeInfo: scopeInfo, currency: currency, search: search, sort: sort) } + func args() -> Args { Args(scopeInfo: scopeInfo, currency: currency, search: search, sort: sort, includeRefreshes: includeRefreshes) } var scopeInfo: ScopeInfo? var currency: String? var search: String? var sort: String? + var includeRefreshes: Bool? struct Args: Encodable { var scopeInfo: ScopeInfo? var currency: String? var search: String? var sort: String? + var includeRefreshes: Bool? } struct Response: Decodable { // list of transactions @@ -101,10 +103,11 @@ struct ResumeTransaction: WalletBackendFormattedRequest { // MARK: - extension WalletModel { /// ask wallet-core for its list of transactions filtered by searchString - func transactionsT(_ stack: CallStack, scopeInfo: ScopeInfo, searchString: String? = nil, sort: String = "descending") + func transactionsT(_ stack: CallStack, scopeInfo: ScopeInfo, searchString: String? = nil, + sort: String = "descending", includeRefreshes: Bool = false) async -> [Transaction] { // might be called from a background thread itself do { - let request = GetTransactions(scopeInfo: scopeInfo, currency: scopeInfo.currency, search: searchString, sort: sort) + let request = GetTransactions(scopeInfo: scopeInfo, currency: scopeInfo.currency, search: searchString, sort: sort, includeRefreshes: includeRefreshes) let response = try await sendRequest(request, ASYNCDELAY) return response.transactions } catch { diff --git a/TalerWallet1/Model/Transaction.swift b/TalerWallet1/Model/Transaction.swift index 58b9f2c..36d4907 100644 --- a/TalerWallet1/Model/Transaction.swift +++ b/TalerWallet1/Model/Transaction.swift @@ -407,8 +407,9 @@ struct RefreshError: Decodable { var code: Int var when: Timestamp var hint: String - var numErrors: Int - var errors: [HTTPError] + var stack: String? + var numErrors: Int? // how many coins had errors + var errors: [HTTPError]? // 1..max(5, numErrors) } struct RefreshTransactionDetails: Decodable { var refreshReason: RefreshReason diff --git a/TalerWallet1/Model/WalletModel.swift b/TalerWallet1/Model/WalletModel.swift index 6b6a5be..9c57e90 100644 --- a/TalerWallet1/Model/WalletModel.swift +++ b/TalerWallet1/Model/WalletModel.swift @@ -88,8 +88,22 @@ struct VersionInfo: Decodable { } // MARK: - fileprivate struct Testing: Encodable { + var denomselAllowLate: Bool var devModeActive: Bool + var insecureTrustExchange: Bool + var preventThrottling: Bool + var skipDefaults: Bool + var emitObservabilityEvents: Bool // more to come... + + init(devModeActive: Bool) { + self.denomselAllowLate = false + self.devModeActive = devModeActive + self.insecureTrustExchange = false + self.preventThrottling = false + self.skipDefaults = false + self.emitObservabilityEvents = false + } } fileprivate struct Builtin: Encodable { |