Implement shortcuts found in the Articles menu of NNW for Mac
This commit is contained in:
parent
afce6ff26f
commit
9a52834b7a
|
@ -151,7 +151,7 @@ class DetailViewController: UIViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func toggleStar(_ sender: Any) {
|
@IBAction func toggleStar(_ sender: Any) {
|
||||||
coordinator.toggleStarForCurrentArticle()
|
coordinator.toggleStarredForCurrentArticle()
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func openBrowser(_ sender: Any) {
|
@IBAction func openBrowser(_ sender: Any) {
|
||||||
|
|
|
@ -131,6 +131,21 @@ private extension KeyboardManager {
|
||||||
let goToStarredTitle = NSLocalizedString("Go To Starred", comment: "Go To Starred")
|
let goToStarredTitle = NSLocalizedString("Go To Starred", comment: "Go To Starred")
|
||||||
keys.append(createKeyCommand(title: goToStarredTitle, action: "goToStarred:", input: "3", modifiers: [.command]))
|
keys.append(createKeyCommand(title: goToStarredTitle, action: "goToStarred:", input: "3", modifiers: [.command]))
|
||||||
|
|
||||||
|
let toggleReadTitle = NSLocalizedString("Toggle Read Status", comment: "Toggle Read Status")
|
||||||
|
keys.append(createKeyCommand(title: toggleReadTitle, action: "toggleRead:", input: "U", modifiers: [.command, .shift]))
|
||||||
|
|
||||||
|
let markAllAsReadTitle = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
|
||||||
|
keys.append(createKeyCommand(title: markAllAsReadTitle, action: "markAllAsRead:", input: "k", modifiers: [.command]))
|
||||||
|
|
||||||
|
let markOlderAsReadTitle = NSLocalizedString("Mark Older as Read", comment: "Mark Older as Read")
|
||||||
|
keys.append(createKeyCommand(title: markOlderAsReadTitle, action: "markOlderArticlesAsRead:", input: "k", modifiers: [.command, .shift]))
|
||||||
|
|
||||||
|
let toggleStarredTitle = NSLocalizedString("Toggle Starred Status", comment: "Toggle Starred Status")
|
||||||
|
keys.append(createKeyCommand(title: toggleStarredTitle, action: "toggleStarred:", input: "l", modifiers: [.command, .shift]))
|
||||||
|
|
||||||
|
let openInBrowserTitle = NSLocalizedString("Open In Browser", comment: "Open In Browser")
|
||||||
|
keys.append(createKeyCommand(title: openInBrowserTitle, action: "openInBrowser:", input: UIKeyCommand.inputRightArrow, modifiers: [.command]))
|
||||||
|
|
||||||
return keys
|
return keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,4 +87,12 @@ class RootSplitViewController: UISplitViewController {
|
||||||
coordinator.selectStarredFeed()
|
coordinator.selectStarredFeed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc func toggleRead(_ sender: Any?) {
|
||||||
|
coordinator.toggleReadForCurrentArticle()
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func toggleStarred(_ sender: Any?) {
|
||||||
|
coordinator.toggleStarredForCurrentArticle()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -772,7 +772,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
runCommand(markReadCommand)
|
runCommand(markReadCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
func toggleStarForCurrentArticle() {
|
func toggleStarredForCurrentArticle() {
|
||||||
if let article = currentArticle {
|
if let article = currentArticle {
|
||||||
markArticles(Set([article]), statusKey: .starred, flag: !article.status.starred)
|
markArticles(Set([article]), statusKey: .starred, flag: !article.status.starred)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue