commit 178fb37697530080b1798c8413475329e19216e1
parent e49a55d368b12d3127b07ba430f4e7e00fa29977
Author: Marc Stibane <marc@taler.net>
Date: Fri, 12 Dec 2025 07:41:11 +0100
show scanned talerURIs
Diffstat:
1 file changed, 48 insertions(+), 0 deletions(-)
diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift
@@ -18,6 +18,7 @@ struct ActionsSheet: View {
let stack: CallStack
@Binding var qrButtonTapped: Bool
+ @Environment(\.openURL) private var openURL
@EnvironmentObject private var controller: Controller
@AppStorage("minimalistic") var minimalistic: Bool = false
@AppStorage("demoHints") var demoHints: Bool = true
@@ -77,6 +78,53 @@ struct ActionsSheet: View {
.accessibilityAddTraits(.isLink)
.padding(.bottom, 20)
}
+ if !controller.scannedURLs.isEmpty {
+ Text("Scanned Taler codes:")
+ .talerFont(.body)
+ .multilineTextAlignment(.leading)
+ .fixedSize(horizontal: false, vertical: true)
+ .padding(.bottom, -2)
+ VStack {
+ ForEach(controller.scannedURLs) { scannedURL in
+ let action = {
+ dismissTop(stack.push())
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
+ // need to wait before opening the next sheet, otherwise SwiftUI doesn't update!
+ openURL(scannedURL.url)
+ }
+ }
+ Button(action: action) {
+ HStack {
+ Text(scannedURL.command.localizedCommand)
+ ButtonIconBadge(type: scannedURL.command.transactionType,
+ foreColor: .accentColor, done: false)
+ .talerFont(.title2)
+
+ Spacer()
+ if let amount = scannedURL.amount {
+ AmountV(scannedURL.scope, amount, isNegative: nil)
+ } else if let baseURL = scannedURL.baseURL {
+ Text(baseURL.trimURL)
+ }
+ }
+ .padding(.horizontal, 8)
+ }
+ .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .center))
+ .swipeActions(edge: .trailing) {
+ Button {
+// symLog?.log("deleteAction")
+ Task { // runs on MainActor
+ controller.removeURL(scannedURL.url)
+ }
+ } label: {
+ Label("Delete", systemImage: "trash")
+ }
+ .tint(WalletColors().negative)
+ }
+
+ }
+ }.padding(.bottom, 20)
+ }
let sendDisabled = !canSend
let recvDisabled = controller.balances.count == 0