adds keyboard shortcuts

- toggle side bar on timeline
- toggle readers view on article
- go to settings on global
This commit is contained in:
Rizwan Mohamed Ibrahim 2020-05-13 17:29:59 +05:30
parent e648623183
commit a9aefd252e
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
5 changed files with 27 additions and 3 deletions

View File

@ -250,6 +250,10 @@ class ArticleViewController: UIViewController {
@IBAction func showActivityDialog(_ sender: Any) {
currentWebViewController?.showActivityDialog(popOverBarButtonItem: actionBarButtonItem)
}
@objc func toggleReaderView(_ sender: Any?) {
currentWebViewController?.toggleArticleExtractor()
}
// MARK: Keyboard Shortcuts
@objc func navigateToTimeline(_ sender: Any?) {

View File

@ -138,6 +138,9 @@ private extension KeyboardManager {
let goToStarredTitle = NSLocalizedString("Go To Starred", comment: "Go To Starred")
keys.append(KeyboardManager.createKeyCommand(title: goToStarredTitle, action: "goToStarred:", input: "3", modifiers: [.command]))
let gotoSettings = NSLocalizedString("Go To Settings", comment: "Go To Settings")
keys.append(KeyboardManager.createKeyCommand(title: gotoSettings, action: "goToSettings:", input: ",", modifiers: [.command]))
let articleSearchTitle = NSLocalizedString("Article Search", comment: "Article Search")
keys.append(KeyboardManager.createKeyCommand(title: articleSearchTitle, action: "articleSearch:", input: "f", modifiers: [.command, .alternate]))
@ -186,6 +189,12 @@ private extension KeyboardManager {
let toggleStarredTitle = NSLocalizedString("Toggle Starred Status", comment: "Toggle Starred Status")
keys.append(KeyboardManager.createKeyCommand(title: toggleStarredTitle, action: "toggleStarred:", input: "l", modifiers: [.command, .shift]))
let toggleSidebar = NSLocalizedString("Toggle Sidebar", comment: "Toggle Sidebar")
keys.append(KeyboardManager.createKeyCommand(title: toggleSidebar, action: "toggleSidebar:", input: "s", modifiers: [.command, .control]))
let toggleReaderView = NSLocalizedString("Toggle Reader View", comment: "Toggle Reader View")
keys.append(KeyboardManager.createKeyCommand(title: toggleReaderView, action: "toggleReaderView:", input: "r", modifiers: [.command, .shift]))
return keys
}

View File

@ -156,7 +156,11 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
@objc func showFeedInspector(_ sender: UITapGestureRecognizer) {
coordinator.showFeedInspector()
}
@objc func toggleSidebar(_ sender: Any?) {
coordinator.toggleSidebar()
}
// MARK: API
func restoreSelectionIfNecessary(adjustScroll: Bool) {

View File

@ -121,7 +121,11 @@ class RootSplitViewController: UISplitViewController {
@objc func goToStarred(_ sender: Any?) {
coordinator.selectStarredFeed()
}
@objc func goToSettings(_ sender: Any?) {
coordinator.showSettings()
}
@objc func toggleRead(_ sender: Any?) {
coordinator.toggleReadForCurrentArticle()
}

View File

@ -1199,7 +1199,10 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
func navigateToDetail() {
articleViewController?.focus()
}
func toggleSidebar() {
rootSplitViewController.preferredDisplayMode = rootSplitViewController.displayMode == .allVisible ? .primaryHidden : .allVisible
}
}
// MARK: UISplitViewControllerDelegate