Add search articles keyboard shortcut and make search work in three panel mode
This commit is contained in:
parent
4184246e42
commit
ec4a6f3e0a
|
@ -146,6 +146,9 @@ private extension KeyboardManager {
|
||||||
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
||||||
keys.append(createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
|
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
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,10 @@ class RootSplitViewController: UISplitViewController {
|
||||||
coordinator.showBrowserForCurrentArticle()
|
coordinator.showBrowserForCurrentArticle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func articleSearch(_ sender: Any?) {
|
||||||
|
coordinator.showSearch()
|
||||||
|
}
|
||||||
|
|
||||||
@objc func addNewFeed(_ sender: Any?) {
|
@objc func addNewFeed(_ sender: Any?) {
|
||||||
coordinator.showAdd(.feed)
|
coordinator.showAdd(.feed)
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,11 +327,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
|
|
||||||
func showSearch() {
|
func showSearch() {
|
||||||
selectFeed(nil)
|
selectFeed(nil)
|
||||||
|
installTimelineControllerIfNecessary(animated: false)
|
||||||
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
|
|
||||||
masterTimelineViewController!.coordinator = self
|
|
||||||
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: false)
|
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()) {
|
DispatchQueue.main.asyncAfter(deadline: .now()) {
|
||||||
self.masterTimelineViewController!.showSearchAll()
|
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 {
|
if let ip = indexPath, let node = nodeFor(ip), let fetcher = node.representedObject as? ArticleFetcher {
|
||||||
timelineFetcher = fetcher
|
timelineFetcher = fetcher
|
||||||
updateSelectingActivity(with: node)
|
updateSelectingActivity(with: node)
|
||||||
|
installTimelineControllerIfNecessary(animated: !automated)
|
||||||
if navControllerForTimeline().viewControllers.filter({ $0 is MasterTimelineViewController }).count < 1 {
|
|
||||||
masterTimelineViewController = UIStoryboard.main.instantiateController(ofType: MasterTimelineViewController.self)
|
|
||||||
masterTimelineViewController!.coordinator = self
|
|
||||||
navControllerForTimeline().pushViewController(masterTimelineViewController!, animated: !automated)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
timelineFetcher = nil
|
timelineFetcher = nil
|
||||||
|
|
||||||
|
@ -1473,6 +1464,14 @@ private extension SceneCoordinator {
|
||||||
|
|
||||||
// MARK: Double Split
|
// 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
|
// Note about the Shim Controller
|
||||||
// In the root split view controller's secondary (or detail) position we use a view controller that
|
// 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
|
// only acts as a shim (or wrapper) for the actually desired contents of the second position. This
|
||||||
|
|
Loading…
Reference in New Issue