summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-07-10 13:28:49 +0200
committerMarc Stibane <marc@taler.net>2023-07-10 13:28:49 +0200
commit4a8e217b08d7e9b735ffb657d2660556bc945923 (patch)
tree148d661cb9cc18986ce885b2f25ae91a1b387427
parent407d4a7cd017e66c830bb49752d49fdd5c7169d7 (diff)
downloadtaler-ios-4a8e217b08d7e9b735ffb657d2660556bc945923.tar.gz
taler-ios-4a8e217b08d7e9b735ffb657d2660556bc945923.tar.bz2
taler-ios-4a8e217b08d7e9b735ffb657d2660556bc945923.zip
no need to call urlCommand async
-rw-r--r--TalerWallet1/Views/Sheets/URLSheet.swift43
1 files changed, 17 insertions, 26 deletions
diff --git a/TalerWallet1/Views/Sheets/URLSheet.swift b/TalerWallet1/Views/Sheets/URLSheet.swift
index 723480f..91fa824 100644
--- a/TalerWallet1/Views/Sheets/URLSheet.swift
+++ b/TalerWallet1/Views/Sheets/URLSheet.swift
@@ -11,36 +11,27 @@ struct URLSheet: View {
var urlToOpen: URL
@EnvironmentObject private var controller: Controller
- @State private var urlCommand: UrlCommand? = nil
-
var body: some View {
+ let urlCommand = controller.openURL(urlToOpen)
+
Group {
- if let urlCommand {
- switch urlCommand {
- case .withdraw:
- WithdrawURIView(url: urlToOpen)
- case .pay:
- PaymentURIView(url: urlToOpen)
- case .payPull:
- P2pPayURIView(url: urlToOpen)
- case .payPush:
- P2pReceiveURIView(url: urlToOpen)
- case .unknown:
+ switch urlCommand {
+ case .withdraw:
+ WithdrawURIView(url: urlToOpen)
+ case .pay:
+ PaymentURIView(url: urlToOpen)
+ case .payPull:
+ P2pPayURIView(url: urlToOpen)
+ case .payPush:
+ P2pReceiveURIView(url: urlToOpen)
+ case .unknown: // Error view
+ VStack {
Text("unknown command")
- }
- } else {
- VStack { // Error view
- Spacer()
- Text(controller.messageForSheet ?? urlToOpen.absoluteString)
- .font(.title)
- Spacer()
- Spacer()
- }
- .navigationTitle(navTitle)
+ .font(.title)
+ Text(controller.messageForSheet ?? urlToOpen.absoluteString)
+ }
+ .navigationTitle(navTitle)
}
- }.task {
- symLog.log(urlToOpen)
- urlCommand = controller.openURL(urlToOpen)
}
}
}