Allow searching for posts/users by opening URL with the tusker:// protocol
This commit is contained in:
parent
df8e0dedd4
commit
078f9e076d
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue