diff options
author | Marc Stibane <marc@taler.net> | 2024-01-28 14:44:57 +0100 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2024-01-28 14:44:57 +0100 |
commit | 96736e7cd562700fcc95b85cc1b266c5c1167f1f (patch) | |
tree | d17be7263db4c4eb778264b7fc46120e5a4d2537 | |
parent | c38420b5c3c7f1a0f59a6152a590e1227e21483d (diff) | |
download | taler-ios-96736e7cd562700fcc95b85cc1b266c5c1167f1f.tar.gz taler-ios-96736e7cd562700fcc95b85cc1b266c5c1167f1f.tar.bz2 taler-ios-96736e7cd562700fcc95b85cc1b266c5c1167f1f.zip |
Fake Euro
-rw-r--r-- | TalerWallet1/Controllers/Controller.swift | 1 | ||||
-rw-r--r-- | TalerWallet1/Helper/CurrencySpecification.swift | 12 | ||||
-rw-r--r-- | TalerWallet1/Views/Balances/BalancesSectionView.swift | 2 |
3 files changed, 14 insertions, 1 deletions
diff --git a/TalerWallet1/Controllers/Controller.swift b/TalerWallet1/Controllers/Controller.swift index 78a3686..36e4424 100644 --- 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 index 5422183..2f0319b 100644 --- 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 index 0667225..1965446 100644 --- 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 { |