taler-ios

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

commit 3b59e23a40bd629f3da4eaf8e2c77f8f392152c5
parent 1f02c74dd02d0cbc3b6c0680e8dcac5337b318e2
Author: Marc Stibane <marc@taler.net>
Date:   Sun,  3 Nov 2024 08:20:32 +0100

cleanup

Diffstat:
MTalerWallet1/Views/HelperViews/QRCodeDetailView.swift | 3+--
MTalerWallet1/Views/HelperViews/ScopePicker.swift | 4+---
MTalerWallet1/Views/Sheets/Payment/PayTemplateV.swift | 4++--
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 6++++--
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift | 39+++++++++++++++++----------------------
MTalerWallet1/Views/Transactions/ThreeAmountsSection.swift | 2+-
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 18+++++++++---------
7 files changed, 35 insertions(+), 41 deletions(-)

diff --git a/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift b/TalerWallet1/Views/HelperViews/QRCodeDetailView.swift @@ -9,7 +9,6 @@ import SwiftUI import taler_swift import AVFoundation - struct QRCodeDetailView: View { let talerURI: String let talerCopyShare: String @@ -54,7 +53,7 @@ struct QRCodeDetailView: View { } CopyShare(textToCopy: talerCopyShare) .disabled(false) - // .padding(.bottom) +// .padding(.bottom) .listRowSeparator(.hidden) } diff --git a/TalerWallet1/Views/HelperViews/ScopePicker.swift b/TalerWallet1/Views/HelperViews/ScopePicker.swift @@ -68,7 +68,7 @@ struct ScopePicker: View { .frame(maxWidth: .infinity) // .border(.red) // debugging .pickerStyle(.menu) - .labelsHidden() + .labelsHidden() // be sure to use valid labels for a11y } } .talerFont(.picker) @@ -149,8 +149,6 @@ struct ScopeDropDown: View { chevron.foregroundColor(.clear) .accessibilityHidden(true) } - - }) // .accessibilityElement(children: .combine) .disabled(rowDisabled) .padding(.horizontal, radius / 2) diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift @@ -9,8 +9,8 @@ import SwiftUI import taler_swift import SymLog -// Will be called either by the user scanning a pay-template QR code or tapping the provided link, -// both from the shop's website or even from a printed QR code. +// Will be called either by the user scanning a <pay-template> QR code or tapping the provided link, +// both from the shop's website - or even from a printed QR code. // We check whether amount and/or summary is editable, and finally go to PaymentView struct PayTemplateV: View { private let symLog = SymLogV(0) diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -65,8 +65,10 @@ func templateFee(ppCheck: PreparePayResult?) -> Amount? { //} // MARK: - -// Will be called either by the user scanning a QR code or tapping the provided link, -// both from the shop's website. We show the payment details in a sheet. +// Will be called either by the user scanning a <pay> QR code or tapping the provided link, +// both from the shop's website - or even from a printed QR code. +// We show the payment details in a sheet, and a "Confirm payment" / "Pay now" button. +// This is also the final view after the user entered data of a <pay-template>. struct PaymentView: View { private let symLog = SymLogV(0) let stack: CallStack diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift @@ -72,24 +72,28 @@ struct WithdrawTOSView: View { } // MARK: - extension WithdrawTOSView { + + static func cleanupText(_ term0: String) -> String { + let term1 = term0.replacingOccurrences(of: "\n ", with: " ") // newline + 5 blanks + let term2 = term1.replacingOccurrences(of: "\n ", with: " ") // newline + 4 blanks + let term3 = term2.replacingOccurrences(of: "\n ", with: " ") // newline + 3 blanks + let term4 = term3.replacingOccurrences(of: "\n ", with: " ") // newline + 2 blanks + let term5 = term4.replacingOccurrences(of: "\n ", with: " ") // newline + 1 blank + let term6 = term5.replacingOccurrences(of: "\n", with: " ") // remove all other linebreaks + let term7 = term6.replacingOccurrences(of: " ====", with: "\n====") // add them back for underscoring + let term8 = term7.replacingOccurrences(of: " ----", with: "\n----") // special for "Highlights:" + let term9 = term8.replacingOccurrences(of: " ****", with: "\n****") // special for "Terms of Service:" + return term9 + } + struct plaintextToSV: View { let plaintext: String var body: some View { let components = plaintext.components(separatedBy: "\n\n") - ForEach (components, id: \.self) { term0 in - let term1 = term0.replacingOccurrences(of: "\n ", with: " ") // newline + 5 blanks - let term2 = term1.replacingOccurrences(of: "\n ", with: " ") // newline + 4 blanks - let term3 = term2.replacingOccurrences(of: "\n ", with: " ") // newline + 3 blanks - let term4 = term3.replacingOccurrences(of: "\n ", with: " ") // newline + 2 blanks - let term5 = term4.replacingOccurrences(of: "\n ", with: " ") // newline + 1 blank - let term6 = term5.replacingOccurrences(of: "\n", with: " ") // remove all other linebreaks - let term7 = term6.replacingOccurrences(of: " ====", with: "\n====") // add them back for underscoring - let term8 = term7.replacingOccurrences(of: " ----", with: "\n----") // special for "Highlights:" - let term9 = term8.replacingOccurrences(of: " ****", with: "\n****") // special for "Terms of Service:" Section { - Text(term9) + Text(cleanupText(term0)) .talerFont(.footnote) .foregroundColor(Color(UIColor.label)) } @@ -136,17 +140,8 @@ extension WithdrawTOSView { } else { let components = tos.content.components(separatedBy: "\n\n") ForEach (components, id: \.self) { term0 in - let term1 = term0.replacingOccurrences(of: "\n ", with: " ") // newline + 5 blanks - let term2 = term1.replacingOccurrences(of: "\n ", with: " ") // newline + 4 blanks - let term3 = term2.replacingOccurrences(of: "\n ", with: " ") // newline + 3 blanks - let term4 = term3.replacingOccurrences(of: "\n ", with: " ") // newline + 2 blanks - let term5 = term4.replacingOccurrences(of: "\n ", with: " ") // newline + 1 blank - let term6 = term5.replacingOccurrences(of: "\n", with: " ") // remove all other linebreaks - let term7 = term6.replacingOccurrences(of: " ====", with: "\n====") // add them back for underscoring - let term8 = term7.replacingOccurrences(of: " ----", with: "\n----") // special for "Highlights:" - let term9 = term8.replacingOccurrences(of: " ****", with: "\n****") // special for "Terms of Service:" - Section { - Text(term9) + Section { + Text(cleanupText(term0)) .talerFont(.footnote) .foregroundColor(Color(UIColor.label)) } diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift b/TalerWallet1/Views/Transactions/ThreeAmountsSection.swift @@ -207,7 +207,7 @@ struct ThreeAmounts_Previews: PreviewProvider { static var previews: some View { StateContainer() - // .environment(\.sizeCategory, .extraExtraLarge) Canvas Device Settings +// .environment(\.sizeCategory, .extraExtraLarge) Canvas Device Settings } } #endif diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -184,25 +184,25 @@ struct TransactionSummaryV: View { hasDone: hasDone) // TODO: Retry Countdown, Retry Now button -// if transaction.isRetryable { if let retryAction { +// if transaction.isRetryable, let retryAction { // TransactionButton(transactionId: common.transactionId, command: .retry, // warning: nil, action: abortAction) -// } } // Retry button - if transaction.isAbortable { if let abortAction { +// } // Retry button + if transaction.isAbortable, let abortAction { TransactionButton(transactionId: common.transactionId, command: .abort, warning: String(localized: "Are you sure you want to abort this transaction?"), didExecute: $ignoreThis, action: abortAction) - } } // Abort button - if transaction.isFailable { if let failAction { + } // Abort button + if transaction.isFailable, let failAction { TransactionButton(transactionId: common.transactionId, command: .fail, warning: String(localized: "Are you sure you want to abandon this transaction?"), didExecute: $ignoreThis, action: failAction) - } } // Fail button - if transaction.isDeleteable { if let deleteAction { + } // Fail button + if transaction.isDeleteable, let deleteAction { TransactionButton(transactionId: common.transactionId, command: .delete, warning: String(localized: "Are you sure you want to delete this transaction?"), @@ -214,10 +214,10 @@ struct TransactionSummaryV: View { dismiss(stack) } } - } } // Delete button + } // Delete button }.id(viewId) // change viewId to enforce a draw update .listStyle(myListStyle.style).anyView - } // Group + } // ScrollViewReader .onNotification(.TransactionExpired) { notification in // TODO: Alert user that this tx just expired if checkDismiss(notification, "newTxState.major == expired => dismiss sheet") {