Skip blank, host-less URLs so that app launchers can launch the app using just the scheme (e.g. icecubesapp://) without invoking a safari error page (#502)

Co-authored-by: Greg <greg@cromulentlabs.com>
This commit is contained in:
Greg Gardner 2023-01-28 22:36:20 -08:00 committed by GitHub
parent 59ef1b2909
commit 8a40799a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,7 @@ private struct SafariRouter: ViewModifier {
.onOpenURL(perform: { url in
// Open external URL (from icecubesapp://)
let urlString = url.absoluteString.replacingOccurrences(of: "icecubesapp://", with: "https://")
guard let url = URL(string: urlString) else { return }
guard let url = URL(string: urlString), url.host != nil else { return }
_ = routerPath.handle(url: url)
})
.onAppear {