commit 60fe9037b17f7032816b1bc633206a7e789a75cf
parent 14606fee0ed5538ba7cfc169c0811bd1a61595ad
Author: Marc Stibane <marc@taler.net>
Date: Wed, 25 Feb 2026 14:44:28 +0100
shortcuts from commonAmounts
Diffstat:
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
@@ -102,11 +102,18 @@ struct CurrencyInputView: View {
}
@MainActor
- func shortcuts(_ currencyField: CurrencyField) -> [ShortcutButton] {
- var buttons = shortcutValues.map { value in
- shortcut(for: value, currencyField)
+ func shortcuts(_ currencyField: CurrencyField, _ currencyInfo: CurrencyInfo) -> [ShortcutButton] {
+ var buttons: [ShortcutButton] = []
+ if let commonAmounts = currencyInfo.commonAmounts {
+ buttons = commonAmounts.prefix(4).map { amount in
+ shortcut(for: Int(amount.centValue), currencyField)
+ }
+ } else {
+ buttons = shortcutValues.map { value in
+ shortcut(for: value, currencyField)
+ }
+ buttons.append(shortcut(for: replaceable, currencyField))
}
- buttons.append(shortcut(for: replaceable, currencyField))
return buttons
}
@@ -168,7 +175,7 @@ struct CurrencyInputView: View {
}
}
if #available(iOS 16.4, *) {
- let shortcuts = shortcuts(currencyField)
+ let shortcuts = shortcuts(currencyField, currencyInfo)
ViewThatFits(in: .horizontal) {
HStack {
ForEach(shortcuts, id: \.shortcut) {