taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit e3173dd266df1460ac273373aca839a73042f2bc
parent 0877055ea4bc9023d1c351efc1d48697760079eb
Author: Marc Stibane <marc@taler.net>
Date:   Wed, 26 Jun 2024 14:53:36 +0200

nbs

Diffstat:
MTalerWallet1/Controllers/PublicConstants.swift | 2+-
Mtaler-swift/Sources/taler-swift/Amount.swift | 12+++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift @@ -16,7 +16,7 @@ public let SEVENDAYS: UInt = 7 // 3..9 public let THIRTYDAYS: UInt = 30 // 10..30 public let EMPTYSTRING = "" // avoid automatic translation of empty "" textLiterals in Text() -public let NONBREAKING = "\u{00A0}" +public let NONBREAKING: Character = "\u{00A0}" public let CONFIRM_BANK = "circle.fill" // badge in PendingRow, TransactionRow and TransactionSummary public let NEEDS_KYC = "star.fill" // badge in PendingRow, TransactionRow and TransactionSummary public let PENDING_INCOMING = "plus.diamond" diff --git a/taler-swift/Sources/taler-swift/Amount.swift b/taler-swift/Sources/taler-swift/Amount.swift @@ -4,6 +4,8 @@ */ import Foundation +fileprivate let NONBREAKING: Character = "\u{00A0}" + public func SuperScriptDigit(_ number: UInt32) -> String { switch number { case 0: return String("\u{2070}") @@ -183,11 +185,15 @@ public final class Amount: Codable, Hashable, @unchecked Sendable, CustomStringC } /// The string representation of the amount, formatted as "`integer`.`fraction` `currency`" (with non-breaking space). - public var readableDescription: String { - let NONBREAKING = "\u{00A0}" - return valueStr + NONBREAKING + currency + public var readableDescriptionNBS: String { + return valueStr + String(NONBREAKING) + currency } + /// The string representation of the amount, formatted as "`integer`.`fraction` `currency`" (with space (not non-breaking space)). + public var readableDescription: String { + return valueStr + " " + currency + } + /// Whether the value is valid. An amount is valid if and only if the currency is not empty and the value is less than the maximum allowed value. var valid: Bool { if currency.range(of: Amount.currencyRegex, options: .regularExpression) == nil {