commit 279a009b4ab3586eaa1e9e861c7cb10fe2452a3e
parent f9de329fadf8c9f7a7627a16329884120bcdb280
Author: Marc Stibane <marc@taler.net>
Date: Sun, 14 Jul 2024 10:25:18 +0200
currency name in P2P buttons
Diffstat:
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -64,6 +64,7 @@ struct BalanceCell: View {
struct BalanceRowView: View {
let stack: CallStack
let amount: Amount
+ let currencyName: String
let sendAction: () -> Void
let recvAction: () -> Void
let rowAction: () -> Void
@@ -75,15 +76,14 @@ struct BalanceRowView: View {
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
var body: some View {
- let currency = amount.currencyStr
let sendTitle0 = String(localized: "SendButton_Short", defaultValue: "Send",
comment: "Abbreviation of button `Send (currency)´")
- let sendTitle1 = String(localized: "SendButton_Full", defaultValue: "Send\t\(currency)",
+ let sendTitle1 = String(localized: "SendButton_Full", defaultValue: "Send\t\(currencyName)",
comment: "`Send (currency)´ in Balances - must have ONE \\t and ONE %@")
let requestTitle0 = String(localized: "RequestButton_Short", defaultValue: "Request",
comment: "Abbreviation of button `Request (currency)´")
- let requestTitle1 = String(localized: "RequestButton_Full", defaultValue: "Request\t\(currency)",
+ let requestTitle1 = String(localized: "RequestButton_Full", defaultValue: "Request\t\(currencyName)",
comment: "`Request (currency)´ in Balances - must have ONE \\t and ONE %@")
VStack (alignment: .trailing, spacing: 6) {
BalanceCell(amount: amount,
@@ -132,10 +132,10 @@ struct BalanceRowView_Previews: PreviewProvider {
List {
Section {
- BalanceRowView(stack: CallStack("Preview"), amount: demo,
+ BalanceRowView(stack: CallStack("Preview"), amount: demo, currencyName: DEMOCURRENCY,
sendAction: {}, recvAction: {}, rowAction: {}, balanceDest: nil)
}
- BalanceRowView(stack: CallStack("Preview"), amount: test,
+ BalanceRowView(stack: CallStack("Preview"), amount: test, currencyName: TESTCURRENCY,
sendAction: {}, recvAction: {}, rowAction: {}, balanceDest: nil)
}
}
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -244,6 +244,7 @@ fileprivate struct BalancesNavigationLinksView: View {
let reloadOneAction: ((_ transactionId: String, _ viewHandles: Bool) async throws -> Transaction)
let cameraAction: () -> Void
+ @EnvironmentObject private var controller: Controller
// @EnvironmentObject private var model: WalletModel
@State private var buttonSelected: Int? = nil
@@ -266,6 +267,9 @@ fileprivate struct BalancesNavigationLinksView: View {
var body: some View {
let scopeInfo = balance.scopeInfo
+ let currency = scopeInfo.currency
+ let currencyInfo = controller.info(for: currency)
+ let currencyName = currencyInfo?.scope.currency ?? currency
HStack(spacing: 0) {
NavigationLink(destination: LazyView {
SendAmount(stack: stack.push(),
@@ -299,6 +303,7 @@ fileprivate struct BalancesNavigationLinksView: View {
BalanceRowView(stack: stack.push(),
amount: balance.available,
+ currencyName: currencyName,
sendAction: {
selectAndUpdate(1) // trigger SendAmount NavigationLink
}, recvAction: {