taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 6b726566faa6c55ebde006b0208ca07bac15a8ee
parent 7b8515c617e8c8aa895be96ee5ed02c1e16a3ee0
Author: Marc Stibane <marc@taler.net>
Date:   Thu,  5 Nov 2026 18:42:31 +0100

cleanup

Diffstat:
MTalerWallet1/Controllers/Controller.swift | 11++++++-----
MTalerWallet1/Controllers/PublicConstants.swift | 11+++++++----
MTalerWallet1/Views/HelperViews/QRCodeDetailView.swift | 2+-
MTalerWallet1/Views/Settings/AboutView.swift | 4++--
4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift @@ -365,7 +365,7 @@ class Controller: ObservableObject { if reloaded != balances { for balance in reloaded { let scope = balance.scopeInfo - checkInfo(for: scope) + checkInfo(stack.push() ,for: scope) } #if DEBUG self.logger.log("\(debugId) ••Got new balances, will redraw") @@ -611,12 +611,13 @@ class Controller: ObservableObject { } /// called whenever a new currency pops up - will first load the Exchange and then currencyInfos - func checkInfo(for scope: ScopeInfo) { + func checkInfo(_ stack: CallStack, for scope: ScopeInfo) { if currencyInfos[scope] == nil { Task { let exchange = await exchange(for: scope.url) if let scope2 = exchange?.scopeInfo { let exchangeName = scope2.url ?? "UNKNOWN" + let caller = stack.peek() logger.log(" ❗️got no info for \(scope.currency) -> will update \(exchangeName.trimURL)") await updateInfo2(scope) } else { @@ -767,13 +768,13 @@ extension Controller { if url.path == "/link" { if let fragment = url.fragment { // 'fragment(percentEncoded:)' is only available in iOS 16.0 or newer - var split = fragment.split(separator: "/") + var split = fragment.split(separator: "/") // SLASH if split.first == "taler:" { split.removeFirst() } if let action = split.first { - let joined = split.joined(separator: "/") - if let talerURI = URL(string: "taler://\(joined)") { + let joined = split.joined(separator: SLASH) + if let talerURI = URL(string: TALER + joined) { return (command(String(action)), talerURI) } } diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift @@ -51,6 +51,8 @@ public let SPACE = " " public let SPACECHAR: Character = " " public let NONBREAKING: Character = "\u{00A0}" public let LINEFEED = "\n" +public let SLASH = "/" + public let UNKNOWN = String(localized: "UNKNOWN", comment: "merchant didn't specify the currency, use ALL CAPS") public let LINK = "link" // 􀉣 1.0 (iOS 13) public let MAPPIN = "mappin.and.ellipse" // 􀎫 1.0 (iOS 13) @@ -165,10 +167,11 @@ public let SUNFILL = "sun.max.fill" // 􀆮 public let MOONFILL = "moon.fill" // 􀆺 1.0 (iOS 13) public let HTTPS = "https://" -public let TALER = "taler.net" -public let DEMO = ".demo." + TALER -public let TEST = ".test." + TALER -public let HEAD = ".head." + TALER +public let TALER = "taler://" +public let TALER_NET = "taler.net" +public let DEMO = ".demo." + TALER_NET +public let TEST = ".test." + TALER_NET +public let HEAD = ".head." + TALER_NET public let SANDBOX = "/instances/sandbox/" public let EXCHANGE = "exchange" diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift @@ -62,7 +62,7 @@ struct QRCodeDetailView: View { comment: "e.g. '$ 7.41'") } private var talerCopyShare: String { - if talerURI.hasPrefix("taler://") { + if talerURI.hasPrefix(TALER) { let httpString = String("https://wallet.taler.net/link#\(talerURI.dropFirst(8))") return talerURI + LINEFEED + httpString } diff --git a/TalerWallet1/Views/Settings/AboutView.swift b/TalerWallet1/Views/Settings/AboutView.swift @@ -48,8 +48,8 @@ struct AboutView: View { .onTapGesture(count: 1) { rotationEnabled.toggle() } Group { List { + let talerURI = HTTPS + TALER_NET if #available(iOS 17.7, *) { - let talerURI = HTTPS + TALER BorderWithHCE(talerURI: talerURI, nfcHint: false, size: size, scanHints: nil) { rotatingTaler } @@ -63,7 +63,7 @@ struct AboutView: View { .accessibilityAddTraits(.isLink) .accessibilityRemoveTraits(.isStaticText) .onTapGesture() { - UIApplication.shared.open(URL(string:HTTPS + TALER)!, options: [:]) + UIApplication.shared.open(URL(string: talerURI)!, options: [:]) } SettingsItem(name: String(localized: "Open \(appName) settings"),