taler-ios

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

commit d17dd371c73836d94f7ff4dfa36b35775f671f68
parent 2d85e6ab708b404ec321d49763dac63bc9b1b2bc
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 19 Jun 2025 11:07:07 +0200

BankDialects (GLS) - terminate contract

Diffstat:
ATalerWallet1/Helper/BankDialects.swift | 47+++++++++++++++++++++++++++++++++++++++++++++++
MTalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift | 17+++++++++++------
2 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/TalerWallet1/Helper/BankDialects.swift b/TalerWallet1/Helper/BankDialects.swift @@ -0,0 +1,47 @@ +/* + * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. + * See LICENSE.md + */ +/** + * @author Marc Stibane + */ +import Foundation + +enum BankDialectString { + case deleteExchange // button title + case warningText1 // first warning, simple + case warningText2 // second warning + case warningText3 // consequence for 2nd, with currency name +} + +func localizedString(_ key: BankDialectString, forDialect: BankDialect?, _ option: String = "") -> String { + if forDialect == .gls { + switch key { + case .deleteExchange: + return String(localized: "GLS.Exchange.Delete.Button", defaultValue: "Terminate contract", comment: "button title") + + case .warningText1: + return String(localized: "GLS.Exchange.Delete.Warning1", defaultValue: "Are you sure you want to terminate this contract?") + + case .warningText2: + return String(localized: "GLS.Exchange.Delete.Warning2", defaultValue: "You still have digital money in your wallet. Terminate anyway?") + + case .warningText3: + return String(localized: "GLS.Exchange.Delete.Warning3", defaultValue: "You will loose all \(option) of this contract.", comment: "Currency") + } + } + // more dialects here... + switch key { + case .deleteExchange: + return String(localized: "Exchange.Delete.Button", defaultValue: "Delete payment service", comment: "button title") + + case .warningText1: + return String(localized: "Exchange.Delete.Warning1", defaultValue: "Are you sure you want to delete this payment service?") + + case .warningText2: + return String(localized: "Exchange.Delete.Warning2", defaultValue: "This payment service is in use. Delete anyway?") + + case .warningText3: + return String(localized: "Exchange.Delete.Warning3", defaultValue: "You will loose all \(option) of this payment service.", comment: "Currency") + } +} diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift @@ -139,14 +139,15 @@ struct ExchangeSectionView: View { .listRowSeparator(.hidden) } } - - let buttonTitle = String(localized: "Exchange.Delete", defaultValue: "Delete payment service", comment: "Action button") - let warningText1 = String(localized: "Are you sure you want to delete this payment service?") - let warningText2 = String(localized: "This payment service is in use. Delete anyway?") + let dialect = exchanges.first?.bankComplianceLanguage + let buttonTitle = localizedString(.deleteExchange, forDialect: dialect) + let warningText1 = localizedString(.warningText1, forDialect: dialect) + let warningText2 = localizedString(.warningText2, forDialect: dialect) + let warningText3 = localizedString(.warningText3, forDialect: dialect, currency) WarningButton(warningText: warningText1, buttonTitle: buttonTitle, buttonIcon: "trash", - role: .destructive, // TODO: WalletColors().errorColor + role: .destructive, // optional: use WalletColors().errorColor disabled: $disabled, action: deleteExchange) .padding(.top) @@ -154,12 +155,16 @@ struct ExchangeSectionView: View { Button("Cancel", role: .cancel) { showAlert = false } + Button("Deposit") { + // TODO: Go to "Deposit" view + showAlert = false + } Button(buttonTitle) { deleteExchange() showAlert = false } }, message: { - Text("You will loose all \(currency) of this payment service") + Text(warningText3) }) } header: { BarGraphHeader(stack: stack.push(),