Improve launch performance and fix Search home page quick action

This commit is contained in:
Maurice Parker 2019-09-06 10:29:00 -05:00
parent 546917a866
commit 9f6203e839
3 changed files with 16 additions and 7 deletions

View File

@ -169,6 +169,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
func showSearchAll() {
navigationItem.searchController?.isActive = true
navigationItem.searchController?.searchBar.selectedScopeButtonIndex = 1
navigationItem.searchController?.searchBar.becomeFirstResponder()
}
func focus() {

View File

@ -327,7 +327,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
func showSearch() {
selectFeed(nil)
masterTimelineViewController?.showSearchAll()
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
masterTimelineViewController!.coordinator = self
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: false)
DispatchQueue.main.asyncAfter(deadline: .now()) {
self.masterTimelineViewController!.showSearchAll()
}
}
// MARK: Notifications
@ -633,13 +640,13 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if indexPath == nil {
if rootSplitViewController.isCollapsed {
if masterNavigationController.children.last is DetailViewController {
masterNavigationController.popViewController(animated: false)
masterNavigationController.popViewController(animated: !automated)
}
} else {
let systemMessageViewController = UIStoryboard.main.instantiateController(ofType: SystemMessageViewController.self)
installDetailController(systemMessageViewController, automated: automated)
}
masterTimelineViewController?.updateArticleSelection(animate: true)
masterTimelineViewController?.updateArticleSelection(animate: !automated)
return
}

View File

@ -17,21 +17,22 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// UIWindowScene delegate
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
window = UIWindow(windowScene: scene as! UIWindowScene)
window!.tintColor = AppAssets.netNewsWireBlueColor
window!.rootViewController = coordinator.start()
window!.makeKeyAndVisible()
if let shortcutItem = connectionOptions.shortcutItem {
window!.makeKeyAndVisible()
handleShortcutItem(shortcutItem)
return
}
if let userActivity = connectionOptions.userActivities.first ?? session.stateRestorationActivity {
DispatchQueue.main.asyncAfter(deadline: .now()) {
self.coordinator.handle(userActivity)
}
self.coordinator.handle(userActivity)
}
window!.makeKeyAndVisible()
}
func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {