Add search articles keyboard shortcut and make search work in three panel mode

This commit is contained in:
Maurice Parker 2019-09-07 09:01:29 -05:00
parent 4184246e42
commit ec4a6f3e0a
3 changed files with 17 additions and 11 deletions

View File

@ -146,6 +146,9 @@ private extension KeyboardManager {
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
keys.append(createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
let articleSearchTitle = NSLocalizedString("Article Search", comment: "Article Search")
keys.append(createKeyCommand(title: articleSearchTitle, action: "articleSearch:", input: "f", modifiers: [.command, .shift]))
return keys
}

View File

@ -61,6 +61,10 @@ class RootSplitViewController: UISplitViewController {
coordinator.showBrowserForCurrentArticle()
}
@objc func articleSearch(_ sender: Any?) {
coordinator.showSearch()
}
@objc func addNewFeed(_ sender: Any?) {
coordinator.showAdd(.feed)
}

View File

@ -327,11 +327,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
func showSearch() {
selectFeed(nil)
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
masterTimelineViewController!.coordinator = self
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: false)
installTimelineControllerIfNecessary(animated: false)
DispatchQueue.main.asyncAfter(deadline: .now()) {
self.masterTimelineViewController!.showSearchAll()
}
@ -584,12 +580,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
if let ip = indexPath, let node = nodeFor(ip), let fetcher = node.representedObject as? ArticleFetcher {
timelineFetcher = fetcher
updateSelectingActivity(with: node)
if navControllerForTimeline().viewControllers.filter({ $0 is MasterTimelineViewController }).count < 1 {
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
masterTimelineViewController!.coordinator = self
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: !automated)
}
installTimelineControllerIfNecessary(animated: !automated)
} else {
timelineFetcher = nil
@ -1473,6 +1464,14 @@ private extension SceneCoordinator {
// MARK: Double Split
func installTimelineControllerIfNecessary(animated: Bool) {
if navControllerForTimeline().viewControllers.filter({ $0 is MasterTimelineViewController }).count < 1 {
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
masterTimelineViewController!.coordinator = self
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: animated)
}
}
// Note about the Shim Controller
// In the root split view controller's secondary (or detail) position we use a view controller that
// only acts as a shim (or wrapper) for the actually desired contents of the second position. This