commit 96736e7cd562700fcc95b85cc1b266c5c1167f1f
parent c38420b5c3c7f1a0f59a6152a590e1227e21483d
Author: Marc Stibane <marc@taler.net>
Date: Sun, 28 Jan 2024 14:44:57 +0100
Fake Euro
Diffstat:
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift
@@ -70,6 +70,7 @@ class Controller: ObservableObject {
}
func info(for currency: String) -> CurrencyInfo? {
+// return CurrencyInfo.euro() // FAKE EURO instead of the real Currency
for info in currencyInfos {
if info.scope.currency == currency {
return info
diff --git a/TalerWallet1/Helper/CurrencySpecification.swift b/TalerWallet1/Helper/CurrencySpecification.swift
@@ -78,6 +78,18 @@ public struct CurrencyInfo {
return CurrencyInfo(scope: scope, specs: specs, formatter: formatter)
}
+ public static func euro() -> CurrencyInfo {
+ let currency = "Euro"
+ let scope = ScopeInfo(type: .global, currency: currency)
+ let specs = CurrencySpecification(name: currency,
+ fractionalInputDigits: 2,
+ fractionalNormalDigits: 2,
+ fractionalTrailingZeroDigits: 2,
+ altUnitNames: [0 : "€"])
+ let formatter = CurrencyFormatter.formatter(scope: scope, specs: specs)
+ return CurrencyInfo(scope: scope, specs: specs, formatter: formatter)
+ }
+
/// returns all characters left from the decimalSeparator
func integerPartStr(_ integerStr: String, decimalSeparator: String) -> String {
if let integerIndex = integerStr.endIndex(of: decimalSeparator) {
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -98,7 +98,7 @@ extension BalancesSectionView: View {
reloadOneAction: reloadOneAction)
}
} header: {
- BarGraphHeader(stack: stack.push(), currency: currency)
+ BarGraphHeader(stack: stack.push(), currency: currencyInfo.scope.currency)
}.id(sectionID)
.task {
// if shownSectionID != sectionID {