[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 02/03: CurrencySpecification code
From: |
gnunet |
Subject: |
[taler-taler-ios] 02/03: CurrencySpecification code |
Date: |
Tue, 21 Nov 2023 17:19:17 +0100 |
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 111729ec4d62e38067657d165f4e0ec207d85adb
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Nov 21 17:18:29 2023 +0100
CurrencySpecification code
---
TalerWallet1/Helper/CurrencySpecification.swift | 7 ++++---
TalerWallet1/Views/Balances/PendingRowView.swift | 1 +
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/TalerWallet1/Helper/CurrencySpecification.swift
b/TalerWallet1/Helper/CurrencySpecification.swift
index 812a962..1d957f2 100644
--- a/TalerWallet1/Helper/CurrencySpecification.swift
+++ b/TalerWallet1/Helper/CurrencySpecification.swift
@@ -56,6 +56,7 @@ public struct CurrencyInfo {
public static func zero(_ currency: String) -> CurrencyInfo {
let scope = ScopeInfo(type: .global, currency: currency)
let specs = CurrencySpecification(name: currency,
+ code: currency,
fractionalInputDigits: 0,
fractionalNormalDigits: 0,
fractionalTrailingZeroDigits: 0,
@@ -154,16 +155,16 @@ public struct CurrencySpecification2: Codable, Sendable {
public struct CurrencySpecification: Codable, Sendable {
enum CodingKeys: String, CodingKey {
case name = "name"
-// case decimalSeparator = "decimal_separator"
-// case groupSeparator = "group_separator"
+ case code = "code"
case fractionalInputDigits = "num_fractional_input_digits"
case fractionalNormalDigits = "num_fractional_normal_digits"
case fractionalTrailingZeroDigits =
"num_fractional_trailing_zero_digits"
-// case isCurrencyNameLeading = "is_currency_name_leading"
case altUnitNames = "alt_unit_names"
}
/// some name for this CurrencySpecification
let name: String
+ /// 3-char ISO 4217 code for global currency. Regional MUST be >= 4 letters
+ let code: String
/// how much digits the user may enter after the decimal separator
let fractionalInputDigits: Int
/// €,$,£: 2; some arabic currencies: 3, ¥: 0
diff --git a/TalerWallet1/Views/Balances/PendingRowView.swift
b/TalerWallet1/Views/Balances/PendingRowView.swift
index 1c9b3ad..62f3292 100644
--- a/TalerWallet1/Views/Balances/PendingRowView.swift
+++ b/TalerWallet1/Views/Balances/PendingRowView.swift
@@ -76,6 +76,7 @@ func PreviewCurrencyInfo(_ currency: String, digits: Int) ->
CurrencyInfo {
let unitName = digits == 0 ? "テ" : "ク" // do not use real currency
symbols like "¥" : "€"
let scope = ScopeInfo(type: .global, currency: currency)
let specs = CurrencySpecification(name: currency,
+ code: currency,
fractionalInputDigits: digits,
fractionalNormalDigits: digits,
fractionalTrailingZeroDigits: digits,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.