From 4df2f4614b129300270930179c4d72bea73cb042 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Mon, 10 Oct 2022 15:02:27 -0700 Subject: [PATCH] Bump required version with proto updates --- Meshtastic/MeshtasticApp.swift | 18 +++++++++++++++--- .../Views/Settings/SaveChannelQRCode.swift | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Meshtastic/MeshtasticApp.swift b/Meshtastic/MeshtasticApp.swift index 539b11f1..25e3cbce 100644 --- a/Meshtastic/MeshtasticApp.swift +++ b/Meshtastic/MeshtasticApp.swift @@ -13,6 +13,7 @@ struct MeshtasticAppleApp: App { @State var saveChannels = false @State var incomingUrl: URL? + @State var channelSettings: String? @Environment(\.scenePhase) var scenePhase @@ -27,15 +28,23 @@ struct MeshtasticAppleApp: App { print("URL received \(userActivity)") incomingUrl = userActivity.webpageURL - if incomingUrl!.absoluteString.lowercased().contains("https://meshtastic.org/e/#") { + + if incomingUrl!.absoluteString.lowercased().contains("meshtastic.org/e/#") { + + if let components = incomingUrl?.absoluteString.components(separatedBy: "#") { + channelSettings = components.last! + } saveChannels = true + print("User wants to open a Channel Settings URL: \(incomingUrl?.absoluteString ?? "No QR Code Link")") } if saveChannels { print("User wants to open Channel Settings URL: \(String(describing: incomingUrl!.relativeString))") } } .sheet(isPresented: $saveChannels) { - SaveChannelQRCode(channelHash: incomingUrl?.absoluteString ?? "Empty Channel URL") + + let channelSettingsString = incomingUrl?.absoluteString + SaveChannelQRCode(channelHash: channelSettings ?? "Empty Channel URL") .presentationDetents([.medium, .large]) .presentationDragIndicator(.visible) } @@ -44,7 +53,10 @@ struct MeshtasticAppleApp: App { print("Some sort of URL was received \(url)") incomingUrl = url - if url.absoluteString.lowercased().contains("https://meshtastic.org/e/#") { + if url.absoluteString.lowercased().contains("meshtastic.org/e/#") { + if let components = incomingUrl?.absoluteString.components(separatedBy: "#") { + channelSettings = components.last! + } saveChannels = true print("User wants to open a Channel Settings URL: \(incomingUrl?.absoluteString ?? "No QR Code Link")") } else { diff --git a/Meshtastic/Views/Settings/SaveChannelQRCode.swift b/Meshtastic/Views/Settings/SaveChannelQRCode.swift index 4024f861..cfb4e281 100644 --- a/Meshtastic/Views/Settings/SaveChannelQRCode.swift +++ b/Meshtastic/Views/Settings/SaveChannelQRCode.swift @@ -23,7 +23,7 @@ struct SaveChannelQRCode: View { .padding() Text(channelHash) - .font(.title2) + .font(.callout) .padding() Text("This does not work yet.")