Various improvements

This commit is contained in:
Ilya Laktyushin
2025-07-31 09:55:21 +02:00
parent 02097cc6da
commit ddb09c821d
6 changed files with 68 additions and 103 deletions

View File

@@ -109,12 +109,12 @@ public func formatStarsAmountText(_ amount: StarsAmount, dateTimeFormat: Present
return balanceText
}
public func formatCurrencyAmountText(_ amount: CurrencyAmount, dateTimeFormat: PresentationDateTimeFormat, showPlus: Bool = false) -> String {
public func formatCurrencyAmountText(_ amount: CurrencyAmount, dateTimeFormat: PresentationDateTimeFormat, showPlus: Bool = false, maxDecimalPositions: Int? = 2) -> String {
switch amount.currency {
case .stars:
return formatStarsAmountText(amount.amount, dateTimeFormat: dateTimeFormat, showPlus: showPlus)
case .ton:
return formatTonAmountText(amount.amount.value, dateTimeFormat: dateTimeFormat, showPlus: showPlus)
return formatTonAmountText(amount.amount.value, dateTimeFormat: dateTimeFormat, showPlus: showPlus, maxDecimalPositions: maxDecimalPositions)
}
}