[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 10/40: Use currencyName for buttons
From: |
gnunet |
Subject: |
[taler-taler-ios] 10/40: Use currencyName for buttons |
Date: |
Mon, 22 Jul 2024 22:46:03 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 81502bac681c695789da5f0dfe3faeda20a05a8f
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Jul 18 12:29:23 2024 +0200
Use currencyName for buttons
---
TalerWallet1/Views/Balances/BalancesSectionView.swift | 4 ++--
TalerWallet1/Views/Banking/DepositWithdrawV.swift | 19 ++++++++++++-------
TalerWallet1/Views/Banking/ExchangeRowView.swift | 6 ++++--
TalerWallet1/Views/Banking/ExchangeSectionView.swift | 5 +++--
4 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 4726a06..503a1d1 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -126,9 +126,9 @@ extension BalancesSectionView: View {
.listRowSeparator(.hidden)
}
DepositWithdrawV(stack: stack.push(),
- scopeInfo: balance.scopeInfo,
+ currencyInfo: currencyInfo,
+// scopeInfo: balance.scopeInfo,
amountAvailable: balance.available,
- currency: currencyName,
amountToTransfer: $amountToTransfer) // does still have
the wrong currency
.listRowSeparator(.hidden)
diff --git a/TalerWallet1/Views/Banking/DepositWithdrawV.swift
b/TalerWallet1/Views/Banking/DepositWithdrawV.swift
index 2461dfb..0b04395 100644
--- a/TalerWallet1/Views/Banking/DepositWithdrawV.swift
+++ b/TalerWallet1/Views/Banking/DepositWithdrawV.swift
@@ -12,9 +12,10 @@ import SymLog
struct DepositWithdrawV: View {
private let symLog = SymLogV(0)
let stack: CallStack
- let scopeInfo: ScopeInfo
+ let currencyInfo: CurrencyInfo
+// let scopeInfo: ScopeInfo
let amountAvailable: Amount?
- let currency: String // this is the currency to be
used
+// let currency: String // this is the currency to
be used
@Binding var amountToTransfer: Amount // does still have the wrong
currency
@EnvironmentObject private var model: WalletModel
@@ -23,13 +24,15 @@ struct DepositWithdrawV: View {
@State private var myExchange: Exchange? = nil
func selectAndUpdate(_ button: Int) {
+ let scope = currencyInfo.scope
+ let currency = scope.currency
amountToTransfer.setCurrency(currency)
buttonSelected = button // will trigger NavigationLink
// after user tapped a button, while navigation animation runs,
contact Exchange to update Fees
- if let url = scopeInfo.url {
+ if let url = scope.url {
Task { // runs on MainActor
do {
-// try await model.updateExchange(scopeInfo: scopeInfo)
+ // TODO: try await model.updateExchange(scopeInfo: scope)
try await model.updateExchange(exchangeBaseUrl: url)
} catch { // TODO: error handling - couldn't updateExchange
symLog.log("error: \(error)")
@@ -39,14 +42,16 @@ struct DepositWithdrawV: View {
}
var body: some View {
+ let scope = currencyInfo.scope
+ let currencyName = currencyInfo.specs.name
let depositTitle0 = String(localized: "DepositButton_Short",
defaultValue: "Deposit",
comment: "Abbreviation of button `Deposit
(currency)´")
- let depositTitle1 = String(localized: "Deposit\t\(currency)",
+ let depositTitle1 = String(localized: "Deposit\t\(currencyName)",
comment: "Button `Deposit (currency)´,
must have ONE \\t and ONE %@")
let withdrawTitle0 = String(localized: "WithdrawButton_Short",
defaultValue: "Withdraw",
comment: "Abbreviation of button
`Withdraw (currency)´")
- let withdrawTitle1 = String(localized: "Withdraw\t\(currency)",
+ let withdrawTitle1 = String(localized: "Withdraw\t\(currencyName)",
comment: "Button `Withdraw (currency)´,
must have ONE \\t and ONE %@")
let deposit = LazyView {
DepositIbanV(stack: stack.push(),
@@ -60,7 +65,7 @@ struct DepositWithdrawV: View {
let manualWithdraw = LazyView {
ManualWithdraw(stack: stack.push(),
isSheet: false,
- scopeInfo: scopeInfo,
+ scopeInfo: scope,
exchange: $myExchange,
amountToTransfer: $amountToTransfer)
}
diff --git a/TalerWallet1/Views/Banking/ExchangeRowView.swift
b/TalerWallet1/Views/Banking/ExchangeRowView.swift
index c6668e7..7dc9656 100644
--- a/TalerWallet1/Views/Banking/ExchangeRowView.swift
+++ b/TalerWallet1/Views/Banking/ExchangeRowView.swift
@@ -12,6 +12,7 @@ import SymLog
struct ExchangeRowView: View {
private let symLog = SymLogV(0)
let stack: CallStack
+ let currencyInfo: CurrencyInfo
let exchange: Exchange
// @Binding var depositIBAN: String
// @Binding var accountHolder: String
@@ -53,9 +54,9 @@ struct ExchangeRowView: View {
.listRowSeparator(.hidden)
DepositWithdrawV(stack: stack.push(),
- scopeInfo: exchange.scopeInfo,
+ currencyInfo: currencyInfo,
+// scopeInfo: exchange.scopeInfo,
amountAvailable: amountAvailable,
- currency: currency,
amountToTransfer: $amountToTransfer)
}
.task {
@@ -99,6 +100,7 @@ fileprivate struct ExchangeRow_Container : View {
exchangeUpdateStatus: .ready,
ageRestrictionOptions: [])
ExchangeRowView(stack: CallStack("Preview"),
+ currencyInfo: CurrencyInfo.zero(LONGCURRENCY),
exchange: exchange1,
amountAvailable: Amount(currency: LONGCURRENCY, cent: 5000),
// 50,00
currency: LONGCURRENCY,
diff --git a/TalerWallet1/Views/Banking/ExchangeSectionView.swift
b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
index f162ced..c66eb4c 100644
--- a/TalerWallet1/Views/Banking/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
@@ -45,11 +45,12 @@ struct ExchangeSectionView: View {
#endif
let scopeInfo = exchange.scopeInfo
let currency = scopeInfo.currency
- let currencyInfoOpt = controller.info(for: currency)
// might be nil
- let currencyName = currencyInfoOpt?.scope.currency ?? currency
// might be "Unknown"
+ let currencyInfo = controller.info(for: currency,
controller.currencyTicker)
+ let currencyName = currencyInfo.scope.currency
Section {
// ForEach(exchanges) { exchange in
ExchangeRowView(stack: stack.push(),
+ currencyInfo: currencyInfo,
exchange: exchange,
amountAvailable: amountAvailable(exchange, currency:
currency),
// depositIBAN: $depositIBAN,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 23/40: Pass in currencyInfo, (continued)
- [taler-taler-ios] 23/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 11/40: cleanup, gnunet, 2024/07/22
- [taler-taler-ios] 24/40: BalancesPendingRowV, gnunet, 2024/07/22
- [taler-taler-ios] 29/40: Warning if scanning outgoing from request view, gnunet, 2024/07/22
- [taler-taler-ios] 07/40: checkInfo, gnunet, 2024/07/22
- [taler-taler-ios] 18/40: Use currencyName for a11y, gnunet, 2024/07/22
- [taler-taler-ios] 08/40: Added name & symbol, gnunet, 2024/07/22
- [taler-taler-ios] 14/40: no message, gnunet, 2024/07/22
- [taler-taler-ios] 31/40: BalanceCellV, gnunet, 2024/07/22
- [taler-taler-ios] 17/40: Pass in currencyInfo, gnunet, 2024/07/22
- [taler-taler-ios] 10/40: Use currencyName for buttons,
gnunet <=