From 4b779c052dfbb1eef645dcce2af8a384e4ab2fd3 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Sun, 20 Nov 2022 17:39:13 -0800 Subject: [PATCH] Remove code for logged-out openURL, and capitalize it --- Views/SwiftUI/RootView.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Views/SwiftUI/RootView.swift b/Views/SwiftUI/RootView.swift index 0f65c2f..9882319 100644 --- a/Views/SwiftUI/RootView.swift +++ b/Views/SwiftUI/RootView.swift @@ -14,7 +14,7 @@ struct RootView: View { .environmentObject(viewModel) .transition(.opacity) .handlesExternalEvents(preferring: ["*"], allowing: ["*"]) - .onOpenURL(perform: { openUrl(navigationViewModel, $0) }) + .onOpenURL(perform: { openURL(navigationViewModel, $0) }) .edgesIgnoringSafeArea(.all) .onReceive(navigationViewModel.identityContext.$appPreferences.map(\.colorScheme), perform: setColorScheme) @@ -29,17 +29,11 @@ struct RootView: View { .environmentObject(viewModel) .navigationViewStyle(StackNavigationViewStyle()) .transition(.opacity) - .handlesExternalEvents(preferring: ["*"], allowing: ["*"]) - .onOpenURL(perform: { openUrl(nil, $0) }) } } /// Open `metatext:` URLs from the action extension. - private func openUrl(_ navigationViewModel: NavigationViewModel?, _ metatextUrl: URL) { - guard let navigationViewModel = navigationViewModel else { - // TODO: (Vyr) We haven't logged into an instance yet. Opening a URL should show an error message. - return - } + private func openURL(_ navigationViewModel: NavigationViewModel, _ metatextUrl: URL) { guard let metatextComponents = URLComponents(url: metatextUrl, resolvingAgainstBaseURL: true), metatextComponents.scheme == "metatext"