diff --git a/Gemini-iOS/SceneDelegate.swift b/Gemini-iOS/SceneDelegate.swift index 356a692..95fb111 100644 --- a/Gemini-iOS/SceneDelegate.swift +++ b/Gemini-iOS/SceneDelegate.swift @@ -99,7 +99,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { extension SceneDelegate: NavigationManagerDelegate { func loadNonGeminiURL(_ url: URL) { UIApplication.shared.open(url, options: [.universalLinksOnly: true]) { (success) in - if !success { + guard !success else { return } + if url.scheme == "http" || url.scheme == "https" { if Preferences.shared.useInAppSafari { let config = SFSafariViewController.Configuration() config.entersReaderIfAvailable = Preferences.shared.useReaderMode @@ -108,6 +109,13 @@ extension SceneDelegate: NavigationManagerDelegate { } else { UIApplication.shared.open(url, options: [:]) } + } else { + let alert = UIAlertController(title: "Cannot open '\(url.scheme!)' URL", message: url.absoluteString, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "Copy URL", style: .default, handler: { (_) in + UIPasteboard.general.setObjects([url]) + })) + alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil)) + self.window!.rootViewController!.present(alert, animated: true) } } }