diff --git a/Tusker/AppDelegate.swift b/Tusker/AppDelegate.swift index df476a2a..f243587b 100644 --- a/Tusker/AppDelegate.swift +++ b/Tusker/AppDelegate.swift @@ -30,6 +30,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { if url.host == "x-callback-url" { return XCBManager.handle(url: url) + } else if var components = URLComponents(url: url, resolvingAgainstBaseURL: false), + let tabBarController = window!.rootViewController as? MainTabBarViewController, + let navigationController = tabBarController.viewControllers?[3] as? UINavigationController, + let searchController = navigationController.viewControllers.first as? SearchTableViewController { + + components.scheme = "https" + + tabBarController.selectedIndex = 3 + navigationController.popToRootViewController(animated: false) + + searchController.loadViewIfNeeded() + + let query = components.url!.absoluteString + searchController.searchController.searchBar.searchTextField.text = query + searchController.performSearch(query: query) + + return true } return false }