taler-ios

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

commit 39356f69a4ab9b82a0dd490b487f0c2577826178
parent 2e26142110b52e7f080c780750cc079c9707ab09
Author: Marc Stibane <marc@taler.net>
Date:   Sat, 12 Oct 2024 09:46:20 +0200

EMPTYSTRING

Diffstat:
MTalerWallet1/Backend/WalletBackendError.swift | 8++++----
MTalerWallet1/Controllers/DebugViewC.swift | 2+-
MTalerWallet1/Model/Transaction.swift | 4++--
MTalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift | 2+-
MTalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift | 2+-
MTalerWallet1/Views/Balances/BalancesListView.swift | 2+-
MTalerWallet1/Views/HelperViews/CurrencyField.swift | 4++--
MTalerWallet1/Views/HelperViews/TextFieldAlert.swift | 2+-
MTalerWallet1/Views/Main/ErrorView.swift | 2+-
MTalerWallet1/Views/Main/MainView.swift | 2+-
MTalerWallet1/Views/Settings/SettingsItem.swift | 3+--
MTalerWallet1/Views/Sheets/Sheet.swift | 2+-
MTalerWallet1/Views/Sheets/WithdrawExchangeV.swift | 4++--
MTalerWallet1/Views/Transactions/ManualDetailsV.swift | 2+-
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 6+++---
15 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/TalerWallet1/Backend/WalletBackendError.swift b/TalerWallet1/Backend/WalletBackendError.swift @@ -85,21 +85,21 @@ struct WalletBackendResponseError: Codable { extension WalletCore { static func serializeRequestError() -> WalletBackendResponseError { return WalletBackendResponseError(code: -1, when: Timestamp.now(), - hint: "Could not serialize request.", message: "") + hint: "Could not serialize request.", message: EMPTYSTRING) } static func parseResponseError() -> WalletBackendResponseError { return WalletBackendResponseError(code: -2, when: Timestamp.now(), - hint: "Could not parse response.", message: "") + hint: "Could not parse response.", message: EMPTYSTRING) } static func parseFailureError() -> WalletBackendResponseError { return WalletBackendResponseError(code: -3, when: Timestamp.now(), - hint: "Could not parse error detail.", message: "") + hint: "Could not parse error detail.", message: EMPTYSTRING) } static func walletError() -> WalletBackendResponseError { return WalletBackendResponseError(code: -4, when: Timestamp.now(), - hint: "Error detail.", message: "") + hint: "Error detail.", message: EMPTYSTRING) } } diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift @@ -125,7 +125,7 @@ struct DebugViewV: View { // let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear #endif let viewIDString = debugViewC.viewID > 0 ? String(debugViewC.viewID) - : "" + : EMPTYSTRING HStack { Spacer() Spacer() diff --git a/TalerWallet1/Model/Transaction.swift b/TalerWallet1/Model/Transaction.swift @@ -280,7 +280,7 @@ struct TransactionCommon: Decodable, Sendable { func localizedType(_ type: TransactionType) -> String { switch type { - case .dummy: return String("") + case .dummy: return String(EMPTYSTRING) case .withdrawal: return String(localized: "Withdrawal", comment: "TransactionType") case .deposit: return String(localized: "Deposit", @@ -686,7 +686,7 @@ enum Transaction: Decodable, Hashable, Identifiable, Sendable { case .peer2peer(let p2pTransaction): result[EXCHANGEBASEURL] = p2pTransaction.details.exchangeBaseUrl result["summary"] = p2pTransaction.details.info.summary - result[TALERURI] = p2pTransaction.details.talerUri ?? "" + result[TALERURI] = p2pTransaction.details.talerUri ?? EMPTYSTRING case .recoup(let recoupTransaction): result["reason"] = recoupTransaction.details.recoupReason case .denomLoss(let denomLossTransaction): diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift @@ -157,7 +157,7 @@ struct P2PSubjectV: View { #if DEBUG //struct SendPurpose_Previews: PreviewProvider { // static var previews: some View { -// @State var summary: String = "" +// @State var summary: String = EMPTYSTRING // @State var expireDays: UInt = 0 // let amount = Amount(currency: LONGCURRENCY, integer: 10, fraction: 0) // SendPurpose(amountAvailable: amount, diff --git a/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift b/TalerWallet1/Views/Actions/Peer2peer/SendAmountV.swift @@ -319,7 +319,7 @@ struct SendAmountContent: View { #if DEBUG fileprivate struct Preview_Content: View { @State private var amountToPreview = Amount(currency: DEMOCURRENCY, cent: 510) - @State private var summary: String = "" + @State private var summary: String = EMPTYSTRING @State private var currencyInfoL: CurrencyInfo = CurrencyInfo.zero(DEMOCURRENCY) @State private var noBalance: Balance? = nil diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift @@ -25,7 +25,7 @@ struct BalancesListView: View { @State private var lastReloadedBalances = 0 @State private var amountToTransfer = Amount.zero(currency: EMPTYSTRING) // Update currency when used - @State private var summary: String = "" + @State private var summary = EMPTYSTRING /// runs on MainActor if called in some Task {} @discardableResult diff --git a/TalerWallet1/Views/HelperViews/CurrencyField.swift b/TalerWallet1/Views/HelperViews/CurrencyField.swift @@ -167,7 +167,7 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable { private var textfieldRepresentable: CurrencyTextfieldRepresentable // Last valid text input string to be displayed - private var lastValidInput: String? = "" + private var lastValidInput: String? = EMPTYSTRING init(_ representable: CurrencyTextfieldRepresentable) { self.textfieldRepresentable = representable @@ -222,7 +222,7 @@ struct CurrencyTextfieldRepresentable: UIViewRepresentable { } // Iterate through each char of the new string and compare LTR with old string - let char = (textField.text ?? "").first { next in + let char = (textField.text ?? EMPTYSTRING).first { next in // If old text is empty or its next character doesn't match new if oldText.isEmpty || next != oldText.removeFirst() { // Found the mismatching character diff --git a/TalerWallet1/Views/HelperViews/TextFieldAlert.swift b/TalerWallet1/Views/HelperViews/TextFieldAlert.swift @@ -61,7 +61,7 @@ extension View { title: String, doneText: String, text: Binding<String>, - placeholder: String = "", + placeholder: String = EMPTYSTRING, action: @escaping (String) -> Void ) -> some View { self.modifier(TextFieldAlert(isPresented: isPresented, title: title, doneText: doneText, text: text, placeholder: placeholder, action: action)) diff --git a/TalerWallet1/Views/Main/ErrorView.swift b/TalerWallet1/Views/Main/ErrorView.swift @@ -18,6 +18,6 @@ struct ErrorView: View { struct ErrorView_Previews: PreviewProvider { static var previews: some View { - ErrorView(errortext: "") + ErrorView(errortext: EMPTYSTRING) } } diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift @@ -257,7 +257,7 @@ extension MainView { @State private var showActionSheet = false @State private var sheetHeight: CGFloat = .zero @State private var amountToTransfer = Amount.zero(currency: EMPTYSTRING) // Update currency when used - @State private var summary: String = "" + @State private var summary: String = EMPTYSTRING @State private var showSpendingHint = true @State private var myExchange: Exchange? = nil diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift b/TalerWallet1/Views/Settings/SettingsItem.swift @@ -158,7 +158,6 @@ struct SettingsTriState: View { } var body: some View { let image = imageName(value) - let accHint = description ?? "" // avoid automatic translation of "" in accessibilityHint VStack { HStack { @@ -192,7 +191,7 @@ struct SettingsTriState: View { .accessibilityElement(children: .combine) .accessibilityLabel(name) .accessibility(value: Text(image.1)) - .accessibilityHint(accHint) + .accessibilityHint(description ?? EMPTYSTRING) .padding([.bottom], 4) } } diff --git a/TalerWallet1/Views/Sheets/Sheet.swift b/TalerWallet1/Views/Sheets/Sheet.swift @@ -35,7 +35,7 @@ struct Sheet: View { var body: some View { let idString = debugViewC.sheetID > 0 ? String(debugViewC.sheetID) - : "" // show nothing if 0 + : EMPTYSTRING // show nothing if 0 NavigationView { Group { if let error2 = model.error2 { diff --git a/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift b/TalerWallet1/Views/Sheets/WithdrawExchangeV.swift @@ -19,7 +19,7 @@ struct WithdrawExchangeV: View { @EnvironmentObject private var controller: Controller @EnvironmentObject private var model: WalletModel - @State private var amountToTransfer = Amount.zero(currency: "") + @State private var amountToTransfer = Amount.zero(currency: EMPTYSTRING) @State private var exchange: Exchange? = nil @State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN) @@ -62,7 +62,7 @@ struct WithdrawExchangeV: View { } else { let currency = exc.scopeInfo.currency amountToTransfer.setCurrency(currency) - // is already Amount.zero(currency: "") + // is already Amount.zero() } exchange = exc } else { diff --git a/TalerWallet1/Views/Transactions/ManualDetailsV.swift b/TalerWallet1/Views/Transactions/ManualDetailsV.swift @@ -38,7 +38,7 @@ struct SegmentControl: View { let detail = accountDetails[index] let specs = detail.currencySpecification let amount = detail.transferAmount - let amountStr = amount?.formatted(specs: specs, isNegative: false, useISO: false) ?? "" + let amountStr = amount?.formatted(specs: specs, isNegative: false, useISO: false) ?? EMPTYSTRING let bankName = detail.bankLabel let a11yLabel = bankName != nil ? (bankName! + " " + amountStr) : amountStr // let _ = print(amountStr) diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -17,7 +17,7 @@ extension Transaction { // for Dummys txState: TransactionState(major: .pending), amountEffective: amount, amountRaw: amount, - transactionId: "", + transactionId: EMPTYSTRING, timestamp: now, txActions: []) self = .dummy(DummyTransaction(common: common)) @@ -65,7 +65,7 @@ struct TransactionSummaryV: View { @MainActor @discardableResult - func checkDismiss(_ notification: Notification, _ logStr: String = "") -> Bool { + func checkDismiss(_ notification: Notification, _ logStr: String = EMPTYSTRING) -> Bool { if hasDone { if let transition = notification.userInfo?[TRANSACTIONTRANSITION] as? TransactionTransition { if transition.transactionId == transaction.common.transactionId { // is the transition for THIS transaction? @@ -89,7 +89,7 @@ struct TransactionSummaryV: View { } } - func checkReload(_ notification: Notification, _ logStr: String = "") { + func checkReload(_ notification: Notification, _ logStr: String = EMPTYSTRING) { if let transition = notification.userInfo?[TRANSACTIONTRANSITION] as? TransactionTransition { if transition.transactionId == transactionId { // is the transition for THIS transaction? let newMajor = transition.newTxState.major