diff --git a/Gemini-iOS/Info.plist b/Gemini-iOS/Info.plist index 2688b32..a92d19d 100644 --- a/Gemini-iOS/Info.plist +++ b/Gemini-iOS/Info.plist @@ -16,6 +16,19 @@ $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 + CFBundleURLTypes + + + CFBundleTypeRole + Viewer + CFBundleURLName + net.shadowfacts.gemini + CFBundleURLSchemes + + gemini + + + CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/Gemini-iOS/SceneDelegate.swift b/Gemini-iOS/SceneDelegate.swift index c44d55f..811ebf1 100644 --- a/Gemini-iOS/SceneDelegate.swift +++ b/Gemini-iOS/SceneDelegate.swift @@ -14,13 +14,22 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? - let navigationManager = NavigationManager(url: URL(string: "gemini://gemini.circumlunar.space/")!) + var navigationManager: NavigationManager! func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + let initialURL: URL + + if let context = connectionOptions.urlContexts.first { + initialURL = context.url + } else { + initialURL = URL(string: "gemini://gemini.circumlunar.space/")! + } + + navigationManager = NavigationManager(url: initialURL) navigationManager.delegate = self // Create the SwiftUI view that provides the window contents. @@ -34,6 +43,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window.makeKeyAndVisible() } } + + func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { + if let context = URLContexts.first { + navigationManager.changeURL(context.url) + } + } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system.