[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 09/11: currencySymbol
From: |
gnunet |
Subject: |
[taler-taler-ios] 09/11: currencySymbol |
Date: |
Sat, 10 Aug 2024 04:29:29 +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 5737152e074c7623193d20a2d5d9a240b5479f0d
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Aug 8 20:55:46 2024 +0200
currencySymbol
---
TalerWallet1/Views/Balances/BalancesSectionView.swift | 9 +++++++--
TalerWallet1/Views/Banking/DepositAmountV.swift | 2 +-
TalerWallet1/Views/Banking/DepositIbanV.swift | 11 +++++++----
TalerWallet1/Views/Banking/ExchangeSectionView.swift | 9 +++++++--
TalerWallet1/Views/Banking/ManualWithdraw.swift | 2 +-
TalerWallet1/Views/HelperViews/BarGraph.swift | 11 ++++++-----
TalerWallet1/Views/Overview/OverviewSectionV.swift | 9 +++++++--
TalerWallet1/Views/Peer2peer/RequestPayment.swift | 2 +-
TalerWallet1/Views/Peer2peer/SendAmount.swift | 2 +-
9 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 0565abc..2054172 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -47,6 +47,7 @@ struct BalancesSectionView {
@State private var pendingTransactions: [Transaction] = []
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@State private var currencyName: String = UNKNOWN
+ @State private var currencySymbol: String = UNKNOWN
// @State private var buttonSelected: Int? = nil
private static func className() -> String {"\(self)"}
@@ -168,13 +169,17 @@ extension BalancesSectionView: View {
amountToTransfer: $amountToTransfer) // does still have
the wrong currency
} header: {
- BarGraphHeader(stack: stack.push(), scopeInfo: scopeInfo,
currencyName: currencyName,
- shouldReloadBalances: $shouldReloadBalances)
+ BarGraphHeader(stack: stack.push(),
+ scopeInfo: scopeInfo,
+ currencyName: $currencyName,
+ currencySymbol: $currencySymbol,
+ shouldReloadBalances: $shouldReloadBalances)
}.id(sectionID)
.listRowSeparator(.hidden)
.task(id: controller.currencyTicker) {
currencyInfo = controller.info(for: currency,
controller.currencyTicker)
currencyName = currencyInfo.scope.currency
+ currencySymbol = currencyInfo.altUnitSymbol ?? currencyName
}
.task(id: shouldReloadBalances + 1_000_000) {
// if shownSectionID != sectionID {
diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift
b/TalerWallet1/Views/Banking/DepositAmountV.swift
index 4ba213f..f891bd6 100644
--- a/TalerWallet1/Views/Banking/DepositAmountV.swift
+++ b/TalerWallet1/Views/Banking/DepositAmountV.swift
@@ -90,7 +90,7 @@ struct DepositAmountV: View {
} else {
let currency = amountToTransfer.currencyStr
- let currencySymbol = currencyInfo.specs.altUnitNames?[0] ??
currencyInfo.specs.name
+ let currencySymbol = currencyInfo.altUnitSymbol ??
currencyInfo.specs.name
let navTitle = String(localized: "NavTitle_Deposit_Currency",
defaultValue: "Deposit \(currencySymbol)",
comment: "NavTitle: Deposit
'currencySymbol'")
diff --git a/TalerWallet1/Views/Banking/DepositIbanV.swift
b/TalerWallet1/Views/Banking/DepositIbanV.swift
index d356776..c63e3b8 100644
--- a/TalerWallet1/Views/Banking/DepositIbanV.swift
+++ b/TalerWallet1/Views/Banking/DepositIbanV.swift
@@ -40,10 +40,13 @@ struct DepositIbanV: View {
return String(localized: "Deposit \(amountWithCurrency)", comment:
"amount with currency")
}
- private func subjectTitle(_ amount: Amount) -> String {
-// let amountStr = amount.formatted(currencyInfo, isNegative: true)
+ private var subjectTitle: String {
+// let currencyName = currencyInfo.scope.currency
+// let currencySymbol = currencyInfo.altUnitSymbol ?? currencyName
return String(localized: "NavTitle_Deposit_AmountStr",
- defaultValue: "Deposit", comment: "NavTitle: Deposit")
+// defaultValue: "Deposit \(currencySymbol)",
+ defaultValue: "Deposit IBAN",
+ comment: "NavTitle: Deposit")
// defaultValue: "Deposit \(amountStr)", comment: "NavTitle:
Deposit 'amountStr'")
}
@@ -120,7 +123,7 @@ struct DepositIbanV: View {
.accessibilityHint(disabled ? String(localized: "enabled when
account holder and IBAN are set") : EMPTYSTRING)
}.padding(.horizontal) } // ScrollVStack
// .scrollBounceBehavior(.basedOnSize) needs iOS 16.4
- .navigationTitle(subjectTitle(amountToTransfer))
+ .navigationTitle(subjectTitle)
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
.onAppear {
DebugViewC.shared.setViewID(VIEW_DEPOSIT_ACCEPT, stack:
stack.push())
diff --git a/TalerWallet1/Views/Banking/ExchangeSectionView.swift
b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
index 4ce7a31..09c1ab9 100644
--- a/TalerWallet1/Views/Banking/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Banking/ExchangeSectionView.swift
@@ -22,6 +22,7 @@ struct ExchangeSectionView: View {
@State private var shouldReloadBalances: Int = 0
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@State private var currencyName: String = UNKNOWN
+ @State private var currencySymbol: String = UNKNOWN
func amountAvailable(_ exchange: Exchange?, currency: String?) -> Amount? {
if let exchange {
@@ -76,12 +77,16 @@ struct ExchangeSectionView: View {
.padding(.top)
}
} header: {
- BarGraphHeader(stack: stack.push(), scopeInfo: scopeInfo,
currencyName: currencyName,
- shouldReloadBalances: $shouldReloadBalances)
+ BarGraphHeader(stack: stack.push(),
+ scopeInfo: scopeInfo,
+ currencyName: $currencyName,
+ currencySymbol: $currencySymbol,
+ shouldReloadBalances: $shouldReloadBalances)
}
.task(id: controller.currencyTicker) {
currencyInfo = controller.info(for: currency,
controller.currencyTicker)
currencyName = currencyInfo.scope.currency
+ currencySymbol = currencyInfo.altUnitSymbol ?? currencyName
}
}
}
diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift
b/TalerWallet1/Views/Banking/ManualWithdraw.swift
index 704e1f1..7bbebd2 100644
--- a/TalerWallet1/Views/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Banking/ManualWithdraw.swift
@@ -44,7 +44,7 @@ struct ManualWithdraw: View {
let currency = scopeInfo.currency
let currencyInfo = controller.info(for: currency,
controller.currencyTicker)
let currencyName = currencyInfo.scope.currency
- let currencySymbol = currencyInfo.specs.altUnitNames?[0] ??
currencyName
+ let currencySymbol = currencyInfo.altUnitSymbol ?? currencyName
let navTitle = String(localized: "NavTitle_Withdraw (currency)",
defaultValue: "Withdraw \(currencySymbol)",
diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift
b/TalerWallet1/Views/HelperViews/BarGraph.swift
index 81039b9..039629a 100644
--- a/TalerWallet1/Views/HelperViews/BarGraph.swift
+++ b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -11,7 +11,8 @@ struct BarGraphHeader: View {
private let symLog = SymLogV(0)
let stack: CallStack
let scopeInfo: ScopeInfo?
- let currencyName: String
+ @Binding var currencyName: String
+ @Binding var currencySymbol: String
@Binding var shouldReloadBalances: Int
@EnvironmentObject private var model: WalletModel
@@ -25,7 +26,7 @@ struct BarGraphHeader: View {
var body: some View {
HStack (alignment: .center, spacing: 10) {
- if !minimalistic {
+ if !minimalistic || currencyName != currencySymbol {
Text(currencyName)
.talerFont(.title2)
.foregroundColor(WalletColors().secondary(colorScheme,
colorSchemeContrast))
@@ -84,13 +85,13 @@ struct BarGraph: View {
let width = barHeight / 3
Rectangle()
.opacity(0.001)
- .frame (width: width, height: incoming ?
valueTransparent : barHeight)
+ .frame(width: width, height: incoming ?
valueTransparent : barHeight)
Rectangle()
.foregroundColor(incoming ? .green : .red)
- .frame (width: width, height: valueColored)
+ .frame(width: width, height: valueColored)
Rectangle()
.opacity(0.001)
- .frame (width: width, height: incoming ? barHeight
: valueTransparent)
+ .frame(width: width, height: incoming ? barHeight
: valueTransparent)
}
}
}
diff --git a/TalerWallet1/Views/Overview/OverviewSectionV.swift
b/TalerWallet1/Views/Overview/OverviewSectionV.swift
index 3b88cce..0be3e81 100644
--- a/TalerWallet1/Views/Overview/OverviewSectionV.swift
+++ b/TalerWallet1/Views/Overview/OverviewSectionV.swift
@@ -41,6 +41,7 @@ struct OverviewSectionV {
@State private var pendingTransactions: [Transaction] = []
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@State private var currencyName: String = UNKNOWN
+ @State private var currencySymbol: String = UNKNOWN
func reloadOneAction(_ transactionId: String, _ viewHandles: Bool) async
throws -> Transaction {
return try await model.getTransactionByIdT(transactionId, viewHandles:
viewHandles)
@@ -100,12 +101,16 @@ extension OverviewSectionV: View {
.padding(.leading, ICONLEADING)
}
} header: {
- BarGraphHeader(stack: stack.push(), scopeInfo: scopeInfo,
currencyName: currencyName,
- shouldReloadBalances: $shouldReloadBalances)
+ BarGraphHeader(stack: stack.push(),
+ scopeInfo: scopeInfo,
+ currencyName: $currencyName,
+ currencySymbol: $currencySymbol,
+ shouldReloadBalances: $shouldReloadBalances)
}.id(sectionID)
.task(id: controller.currencyTicker) {
currencyInfo = controller.info(for: currency,
controller.currencyTicker)
currencyName = currencyInfo.scope.currency
+ currencySymbol = currencyInfo.altUnitSymbol ?? currencyName
}
.task(id: shouldReloadBalances + 1_000_000) {
// if shownSectionID != sectionID {
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
index 7a72167..772957e 100644
--- a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -98,7 +98,7 @@ struct RequestPayment: View {
#endif
let currency = amountToTransfer.currencyStr
// let currencyInfo = controller.info(for: currency,
controller.currencyTicker)
- let currencySymbol = currencyInfo.specs.altUnitNames?[0] ?? currency
+ let currencySymbol = currencyInfo.altUnitSymbol ?? currency
let navTitle = String(localized: "NavTitle_Request_Currency",
defaultValue: "Request \(currencySymbol)",
comment: "NavTitle: Request 'currencySymbol'")
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift
b/TalerWallet1/Views/Peer2peer/SendAmount.swift
index f700695..a2eed9c 100644
--- a/TalerWallet1/Views/Peer2peer/SendAmount.swift
+++ b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -105,7 +105,7 @@ struct SendAmount: View {
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
- let currencySymbol = currencyInfo.specs.altUnitNames?[0] ??
currencyInfo.specs.name
+ let currencySymbol = currencyInfo.altUnitSymbol ??
currencyInfo.specs.name
let navTitle = String(localized: "NavTitle_Send_Currency",
defaultValue: "Send \(currencySymbol)",
comment: "NavTitle: Send 'currencySymbol'")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (022a1b3 -> fb443d4), gnunet, 2024/08/09
- [taler-taler-ios] 04/11: DepositWireTypesForCurrency, gnunet, 2024/08/09
- [taler-taler-ios] 03/11: layout, gnunet, 2024/08/09
- [taler-taler-ios] 02/11: ShareButton title, gnunet, 2024/08/09
- [taler-taler-ios] 01/11: callStack, gnunet, 2024/08/09
- [taler-taler-ios] 11/11: Bump version to 0.12.0 (0.12.9), gnunet, 2024/08/09
- [taler-taler-ios] 05/11: ManualDetailsWireV, gnunet, 2024/08/09
- [taler-taler-ios] 06/11: QRcodesForPayto, gnunet, 2024/08/09
- [taler-taler-ios] 07/11: cleanup, gnunet, 2024/08/09
- [taler-taler-ios] 10/11: ManualDetails, gnunet, 2024/08/09
- [taler-taler-ios] 09/11: currencySymbol,
gnunet <=
- [taler-taler-ios] 08/11: German translation, gnunet, 2024/08/09