taler-ios

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

commit 56c8cc8be62030dffa8a7189a4d6a6c57a90a04b
parent b4edb8d136bbd773adaf13bd11a94f9ed346b244
Author: Marc Stibane <marc@taler.net>
Date:   Sat,  5 Sep 2026 13:20:26 +0200

Accept

Diffstat:
MTalerWallet1/Views/Transactions/TransactionsEmptyView.swift | 43+++++++++++++++++++++++++++++++++++++------
1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/TalerWallet1/Views/Transactions/TransactionsEmptyView.swift b/TalerWallet1/Views/Transactions/TransactionsEmptyView.swift @@ -44,6 +44,8 @@ struct UnconfirmedKeyChangeView: View { @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic @State private var exchange: Exchange? = nil + @State private var alertAccept: Bool = false + @State private var alertDelete: Bool = false func notValid(_ amountString: String) -> String { String(localized: "Unfortunately this means, that your \(amountString) are not valid anymore, because they were obtained with the old security identity.") @@ -87,6 +89,25 @@ struct UnconfirmedKeyChangeView: View { } } + private var acceptButton: some View { + Button("Accept") { + alertAccept = false + acceptAction() + } + } + private var deleteButton: some View { + Button("Delete") { + alertDelete = false + deleteAction() + } + } + private var dismissAlertButton: some View { + Button("Cancel", role: .cancel) { + alertAccept = false + alertDelete = false + } + } + @MainActor private func viewDidLoad() async { exchange = await controller.exchange(for: baseURL) @@ -96,7 +117,7 @@ struct UnconfirmedKeyChangeView: View { let scope = balance.scopeInfo let available = balance.available let formatted = available.formatted(scope, isNegative: false) - let navTitle = String(localized: "Payment service ID", comment: "ViewTitle of UnconfirmedKeyChangeView") + let navTitle = String(localized: "Security Alert!", comment: "ViewTitle of UnconfirmedKeyChangeView") let warning1 = Text("Only trust the new identity if the payment service has confirmed this change.") let warning2 = Text("Otherwise, wait and try again later...") List { @@ -109,21 +130,21 @@ struct UnconfirmedKeyChangeView: View { let a11y = notValid(formatted.1) Text(sorry) .accessibilityLabel(a11y) - + warning1 .talerFont(.body) warning2 .bold() .talerFont(.body) - + Button(keep(formatted.0), action: keepAction) .buttonStyle(TalerButtonStyle(type: .bordered)) .padding(.horizontal) .accessibilityLabel(keep(formatted.1)) - + Text("If you are sure that the old security identity will not be used anymore, you can delete the invalid money.") .talerFont(.body) - Button(delete(formatted.0), action: deleteAction) + Button(delete(formatted.0), action: { alertDelete = true }) .buttonStyle(TalerButtonStyle(type: .bordered)) .padding(.horizontal) .accessibilityLabel(delete(formatted.1)) @@ -133,7 +154,7 @@ struct UnconfirmedKeyChangeView: View { warning2 .bold() Text("If you are sure that the old security identity will not be used anymore, you can withdraw new money with the new security identity.") - Button("Accept new security identity", action: acceptAction) + Button("Accept new security identity", action: { alertAccept = true }) .buttonStyle(TalerButtonStyle(type: .bordered)) .padding(.horizontal) Text("Money you obtained with the old security identity will be invalid.") @@ -148,6 +169,16 @@ struct UnconfirmedKeyChangeView: View { .task { await viewDidLoad() } + .alert("Accept the new payment service security identity.", + isPresented: $alertAccept, + actions: { acceptButton + dismissAlertButton }, + message: { Text("Are you sure? Your money obtained with the old security identity will be invalid.") }) + .alert("Delete money obtained with the old security identity.", + isPresented: $alertDelete, + actions: { deleteButton + dismissAlertButton }, + message: { Text("Are you sure? That money will be lost.") }) } } // MARK: -