taler-ios

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

commit 00222d2bad943391b9e8e8d1bc96f8167623b26e
parent 81502bac681c695789da5f0dfe3faeda20a05a8f
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 18 Jul 2024 13:38:07 +0200

cleanup

Diffstat:
MTalerWallet1/Backend/WalletBackendRequest.swift | 4++--
MTalerWallet1/Views/Balances/BalanceRowView.swift | 6+++---
MTalerWallet1/Views/Balances/BalancesSectionView.swift | 7++-----
MTalerWallet1/Views/Banking/ManualWithdraw.swift | 10+++++-----
MTalerWallet1/Views/Banking/QuiteSomeCoins.swift | 6++----
MTalerWallet1/Views/Peer2peer/P2PSubjectV.swift | 2+-
MTalerWallet1/Views/Peer2peer/RequestPayment.swift | 14+++++++-------
MTalerWallet1/Views/Peer2peer/SendAmount.swift | 4++--
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift | 10+++++-----
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift | 5++---
10 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/TalerWallet1/Backend/WalletBackendRequest.swift b/TalerWallet1/Backend/WalletBackendRequest.swift @@ -33,7 +33,7 @@ struct ScopeInfo: Codable, Hashable { } var type: ScopeInfoType var noFees: Bool? // only for "global". Regional have this field per Exchange - var url: String? // only for "exchange" + var url: String? // only for "exchange" and "auditor" var currency: String // 3-char ISO 4217 code for global currency. Regional MUST be >= 4 letters public static func < (lhs: ScopeInfo, rhs: ScopeInfo) -> Bool { @@ -53,7 +53,7 @@ struct ScopeInfo: Codable, Hashable { } return true } - if let rhsBaseURL = rhs.url { + if rhs.url != nil { return false } // fall thru diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift @@ -64,8 +64,8 @@ struct BalanceCell: View { /// [Send Money] [Request Payment] struct BalanceRowView: View { let stack: CallStack - let amount: Amount let currencyName: String + let amount: Amount let sendAction: () -> Void let recvAction: () -> Void let rowAction: () -> Void @@ -134,10 +134,10 @@ struct BalanceRowView_Previews: PreviewProvider { List { Section { - BalanceRowView(stack: CallStack("Preview"), amount: demo, currencyName: DEMOCURRENCY, + BalanceRowView(stack: CallStack("Preview"), currencyName: DEMOCURRENCY, amount: demo, sendAction: {}, recvAction: {}, rowAction: {}, balanceDest: nil) } - BalanceRowView(stack: CallStack("Preview"), amount: test, currencyName: TESTCURRENCY, + BalanceRowView(stack: CallStack("Preview"), currencyName: TESTCURRENCY, amount: test, sendAction: {}, recvAction: {}, rowAction: {}, balanceDest: nil) } } diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -81,7 +81,7 @@ extension BalancesSectionView: View { .listRowSeparator(.hidden) } BalancesNavigationLinksView(symLog: symLog, - stack: stack.push(), + stack: stack.push("Section"), balance: balance, amountToTransfer: $amountToTransfer, // does still have the wrong currency summary: $summary, @@ -106,8 +106,6 @@ extension BalancesSectionView: View { .multilineTextAlignment(.leading) .listRowSeparator(.hidden) } - } - if showSpendingButton { let title = String(localized: "LinkTitle_DEMOSHOP", defaultValue: "Spend demo money") let action = { showSpendingHint = false @@ -250,7 +248,6 @@ fileprivate struct BalancesNavigationLinksView: View { let cameraAction: () -> Void @EnvironmentObject private var controller: Controller -// @EnvironmentObject private var model: WalletModel @State private var buttonSelected: Int? = nil @@ -307,8 +304,8 @@ fileprivate struct BalancesNavigationLinksView: View { { EmptyView() }.frame(width: 0).opacity(0).hidden() // TransactionsListView BalanceRowView(stack: stack.push(), - amount: balance.available, currencyName: currencyName, + amount: balance.available, sendAction: { selectAndUpdate(1) // trigger SendAmount NavigationLink }, recvAction: { diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift b/TalerWallet1/Views/Banking/ManualWithdraw.swift @@ -75,11 +75,11 @@ struct ManualWithdraw: View { : String(localized: "Amount to withdraw:"), shortcutAction: nil) .padding(.top) - QuiteSomeCoins(coinData: coinData, - shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees - currency: currency, - currencyInfo: currencyInfo, - amountEffective: withdrawalAmountDetails?.amountEffective) + QuiteSomeCoins(currencyInfo: currencyInfo, + currency: currency, + coinData: coinData, + shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees + amountEffective: withdrawalAmountDetails?.amountEffective) // agePicker NavigationLink(destination: destination) { Text("Confirm Withdrawal") // VIEW_WITHDRAW_ACCEPT diff --git a/TalerWallet1/Views/Banking/QuiteSomeCoins.swift b/TalerWallet1/Views/Banking/QuiteSomeCoins.swift @@ -60,10 +60,10 @@ extension CoinData { // MARK: - struct QuiteSomeCoins: View { private let symLog = SymLogV(0) + let currencyInfo: CurrencyInfo + let currency: String let coinData: CoinData let shouldShowFee: Bool - let currency: String - let currencyInfo: CurrencyInfo? let amountEffective: Amount? var body: some View { @@ -94,7 +94,5 @@ struct QuiteSomeCoins: View { // QuiteSomeCoins(coinData: CoinData(numCoins: 4, fee: Amount(currency: LONGCURRENCY, cent: 20) ), // shouldShowFee: true, // amountEffective: nil) -// .environment(\.currencyInfo, currencyInfo) -// .environment(\.currencyName, currencyName) // TODO: check if this gets updated!!! // } //} diff --git a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift @@ -21,9 +21,9 @@ func p2pFee(ppCheck: CheckPeerPushDebitResponse) -> Amount? { struct P2PSubjectV: View { private let symLog = SymLogV(0) let stack: CallStack + let currencyInfo: CurrencyInfo let feeLabel: String? let feeIsNotZero: Bool? // nil = no fees at all, false = no fee for this tx - let currencyInfo: CurrencyInfo let amountToSend: Bool @Binding var amountToTransfer: Amount @Binding var summary: String diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift b/TalerWallet1/Views/Peer2peer/RequestPayment.swift @@ -54,9 +54,9 @@ struct RequestPayment: View { let _ = symLog.log("currency: \(currency)") let inputDestination = LazyView { P2PSubjectV(stack: stack.push(), + currencyInfo: currencyInfo, feeLabel: coinData.feeLabel(currencyInfo), feeIsNotZero: feeIsNotZero(), - currencyInfo: currencyInfo, amountToSend: false, amountToTransfer: $amountToTransfer, summary: $summary, @@ -64,9 +64,9 @@ struct RequestPayment: View { } let shortcutDestination = LazyView { P2PSubjectV(stack: stack.push(), + currencyInfo: currencyInfo, feeLabel: nil, feeIsNotZero: feeIsNotZero(), - currencyInfo: currencyInfo, amountToSend: false, amountToTransfer: $amountShortcut, summary: $summary, @@ -80,11 +80,11 @@ struct RequestPayment: View { : String(localized: "Amount to request:"), shortcutAction: shortcutAction) .padding(.top) - QuiteSomeCoins(coinData: coinData, - shouldShowFee: true, // always true since the requester pays fees - currency: currency, - currencyInfo: currencyInfo, - amountEffective: peerPullCheck?.amountEffective) + QuiteSomeCoins(currencyInfo: currencyInfo, + currency: currency, + coinData: coinData, + shouldShowFee: true, // always true since the requester pays fees + amountEffective: peerPullCheck?.amountEffective) NavigationLink(destination: inputDestination) { Text("Next") } .buttonStyle(TalerButtonStyle(type: .prominent, disabled: disabled)) .disabled(disabled) diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift @@ -84,9 +84,9 @@ struct SendAmount: View { let inputDestination = LazyView { P2PSubjectV(stack: stack.push(), + currencyInfo: currencyInfo, feeLabel: feeLabel(feeStr), feeIsNotZero: feeIsNotZero(), - currencyInfo: currencyInfo, amountToSend: true, amountToTransfer: $amountToTransfer, // from the textedit summary: $summary, @@ -94,9 +94,9 @@ struct SendAmount: View { } let shortcutDestination = LazyView { P2PSubjectV(stack: stack.push(), + currencyInfo: currencyInfo, feeLabel: nil, feeIsNotZero: feeIsNotZero(), - currencyInfo: currencyInfo, amountToSend: true, amountToTransfer: $amountShortcut, // from the tapped shortcut button summary: $summary, diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptView.swift @@ -68,11 +68,11 @@ struct WithdrawAcceptView: View { summary: nil, merchant: nil) let coinData = CoinData(details: withdrawalAmountDetails) - QuiteSomeCoins(coinData: coinData, - shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees - currency: currency, - currencyInfo: currencyInfo, - amountEffective: effective) + QuiteSomeCoins(currencyInfo: currencyInfo, + currency: currency, + coinData: coinData, + shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees + amountEffective: effective) } .listStyle(myListStyle.style).anyView .navigationTitle(navTitle) diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift @@ -9,9 +9,6 @@ import MarkdownUI struct WithdrawTOSView: View { private let symLog = SymLogV(0) let stack: CallStack - - let navTitle = String(localized: "Terms of Service") - let exchangeBaseUrl: String? let viewID: Int // either VIEW_WITHDRAW_TOS or SHEET_WITHDRAW_TOS let acceptAction: (() async -> Void)? @@ -22,6 +19,8 @@ struct WithdrawTOSView: View { @State var exchangeTOS: ExchangeTermsOfService? + let navTitle = String(localized: "Terms of Service") + func loadToS(_ language: String) async { if let exchangeBaseUrl { let acceptedFormat: [String] = [MARKDOWN, PLAINTEXT] // MARKDOWN, HTML, PLAINTEXT