taler-ios

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

commit 39c1f1038eda7bc51cf19889115c495f45c977e6
parent 30caf4de0a60e65082ef1ca7aeceeb0b9915f224
Author: Marc Stibane <marc@taler.net>
Date:   Fri,  4 Oct 2024 10:49:21 +0200

trimURL

Diffstat:
MTalerWallet1/Helper/TalerStrings.swift | 2+-
MTalerWallet1/Views/Balances/BalancesSectionView.swift | 2+-
MTalerWallet1/Views/Banking/DepositAmountV.swift | 2+-
MTalerWallet1/Views/Banking/ExchangeRowView.swift | 2+-
MTalerWallet1/Views/Banking/ExchangeSectionView.swift | 2+-
MTalerWallet1/Views/Banking/ManualWithdraw.swift | 2+-
MTalerWallet1/Views/Banking/ManualWithdrawDone.swift | 2+-
MTalerWallet1/Views/HelperViews/LoadingView.swift | 2+-
MTalerWallet1/Views/Overview/OverviewSectionV.swift | 2+-
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 4++--
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift | 8++++----
MTalerWallet1/Views/Transactions/ThreeAmountsSection.swift | 2+-
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 2+-
15 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/TalerWallet1/Helper/TalerStrings.swift b/TalerWallet1/Helper/TalerStrings.swift @@ -7,7 +7,7 @@ import Foundation import UIKit extension StringProtocol { - func trimURL() -> String { + var trimURL: String { if let url = URL(string: String(self)) { if let host = url.host { return host diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -111,7 +111,7 @@ extension BalancesSectionView: View { Section { if scopeInfo.type == .exchange { - let baseURL = scopeInfo.url?.trimURL() ?? String(localized: "Unknown Payment Provider", comment: "exchange url") + let baseURL = scopeInfo.url?.trimURL ?? String(localized: "Unknown Payment Provider", comment: "exchange url") Text(baseURL) .talerFont(.headline) // .listRowSeparator(.hidden) diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift b/TalerWallet1/Views/Banking/DepositAmountV.swift @@ -100,7 +100,7 @@ struct DepositAmountV: View { let disabled = insufficient || amountToTransfer.isZero ScrollView { VStack(alignment: .trailing) { -// Text("via \(exchange.exchangeBaseUrl.trimURL())") +// Text("via \(exchange.exchangeBaseUrl.trimURL)") // .multilineTextAlignment(.center) // .talerFont(.body) diff --git a/TalerWallet1/Views/Banking/ExchangeRowView.swift b/TalerWallet1/Views/Banking/ExchangeRowView.swift @@ -43,7 +43,7 @@ struct ExchangeRowView: View { Group { NavigationLink(destination: showToS) { VStack(alignment: .leading) { - Text(baseURL.trimURL()) + Text(baseURL.trimURL) .talerFont(.headline) if !minimalistic { Text("Terms of Service") // VIEW_WITHDRAW_TOS diff --git a/TalerWallet1/Views/Banking/ExchangeSectionView.swift b/TalerWallet1/Views/Banking/ExchangeSectionView.swift @@ -56,7 +56,7 @@ struct ExchangeSectionView: View { Task { // runs on MainActor let baseUrl = exchange.exchangeBaseUrl if let _ = try? await model.deleteExchange(url: baseUrl, purge: doPurge, viewHandles: !doPurge) { - symLog.log("deleted \(baseUrl.trimURL())") + symLog.log("deleted \(baseUrl.trimURL)") didDelete = true // change button text NotificationCenter.default.post(name: .ExchangeDeleted, object: nil, userInfo: nil) NotificationCenter.default.post(name: .BalanceChange, object: nil, userInfo: nil) diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Banking/ManualWithdraw.swift @@ -68,7 +68,7 @@ struct ManualWithdraw: View { let disabled = amountToTransfer.isZero || coinData.invalid || coinData.tooMany let tosAccepted = exchange.tosStatus == .accepted ScrollView { VStack(alignment: .trailing) { - Text("via \(exchange.exchangeBaseUrl.trimURL())") + Text("via \(exchange.exchangeBaseUrl.trimURL)") .multilineTextAlignment(.center) .talerFont(.body) if tosAccepted { diff --git a/TalerWallet1/Views/Banking/ManualWithdrawDone.swift b/TalerWallet1/Views/Banking/ManualWithdrawDone.swift @@ -56,7 +56,7 @@ struct ManualWithdrawDone: View { .padding(.horizontal) } } else { - LoadingView(scopeInfo: nil, message: exchange.exchangeBaseUrl.trimURL()) + LoadingView(scopeInfo: nil, message: exchange.exchangeBaseUrl.trimURL) } }.onAppear() { symLog.log("onAppear") diff --git a/TalerWallet1/Views/HelperViews/LoadingView.swift b/TalerWallet1/Views/HelperViews/LoadingView.swift @@ -27,7 +27,7 @@ struct LoadingView: View { Spacer() if let scopeInfo { if let urlStr = scopeInfo.url { - Text(urlStr.trimURL()) + Text(urlStr.trimURL) } else { Text(scopeInfo.currency) } diff --git a/TalerWallet1/Views/Overview/OverviewSectionV.swift b/TalerWallet1/Views/Overview/OverviewSectionV.swift @@ -93,7 +93,7 @@ extension OverviewSectionV: View { Section { if scopeInfo.type == .exchange { - let baseURL = scopeInfo.url?.trimURL() ?? String(localized: "Unknown Payment Provider", comment: "exchange url") + let baseURL = scopeInfo.url?.trimURL ?? String(localized: "Unknown Payment Provider", comment: "exchange url") Text(baseURL) .talerFont(.headline) .listRowSeparator(.hidden) diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -92,9 +92,9 @@ struct PaymentView: View { for exchange in exchanges { let baseUrl = exchange.url if let someExchange = try? await model.getExchangeByUrl(url: baseUrl) { - symLog.log("\(baseUrl.trimURL()) loaded") + symLog.log("\(baseUrl.trimURL) loaded") await controller.checkCurrencyInfo(for: baseUrl, model: model) - symLog.log("Info(for: \(baseUrl.trimURL())) loaded") + symLog.log("Info(for: \(baseUrl.trimURL) loaded") return } } diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift @@ -65,7 +65,7 @@ struct WithdrawAcceptDone: View { } } } else { - LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL() + LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL ?? "Bank Authorization") } }.onAppear() { diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift @@ -62,7 +62,7 @@ struct WithdrawTOSView: View { } } } else { - LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL() + LoadingView(scopeInfo: nil, message: exchangeBaseUrl?.trimURL ?? "No exchangeBaseUrl!") .task { await loadToS(languageCode) diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift @@ -49,7 +49,7 @@ struct WithdrawURIView: View { func loadExchange(_ baseUrl: String) async { // TODO: throws? if let someExchange = try? await model.getExchangeByUrl(url: baseUrl) { - symLog.log("Loaded \(baseUrl.trimURL())") + symLog.log("Loaded \(baseUrl.trimURL)") exchange = someExchange } } @@ -116,7 +116,7 @@ struct WithdrawURIView: View { } else { HStack { Text(title) - Text(defaultBaseUrl.trimURL()) + Text(defaultBaseUrl.trimURL) } .talerFont(.body) // .task { @@ -201,9 +201,9 @@ struct WithdrawURIView: View { defaultExchangeBaseUrl = uriInfoResponse.defaultExchangeBaseUrl possibleExchanges = uriInfoResponse.possibleExchanges await loadExchange(baseUrl) - symLog.log("\(baseUrl.trimURL()) loaded") + symLog.log("\(baseUrl.trimURL) loaded") await controller.checkCurrencyInfo(for: baseUrl, model: model) - symLog.log("Info(for: \(baseUrl.trimURL())) loaded") + symLog.log("Info(for: \(baseUrl.trimURL) loaded") } // TODO: amount = nil ==> show amount input diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift b/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift @@ -149,7 +149,7 @@ struct ThreeAmountsSection: View { Text(minimalistic ? "Payment provider:" : "Using payment service provider:") .multilineTextAlignment(.leading) .talerFont(.body) - Text(baseURL.trimURL()) + Text(baseURL.trimURL) .frame(maxWidth: .infinity, alignment: .trailing) .multilineTextAlignment(.center) .talerFont(large ? .title3 : .body) diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -534,7 +534,7 @@ struct TransactionSummaryV: View { } } else if keys.contains(EXCHANGEBASEURL) { if let baseURL = details[EXCHANGEBASEURL] { - Text("from \(baseURL.trimURL())") + Text("from \(baseURL.trimURL)") .talerFont(.title2) .padding(.bottom) }