Implement more keyboard shortcuts
This commit is contained in:
parent
73828e5115
commit
7582ade6f5
|
@ -26,21 +26,29 @@ class RootSplitViewController: UISplitViewController {
|
|||
}
|
||||
|
||||
@objc func nextUnread(_ sender: Any?) {
|
||||
coordinator.selectNextUnread()
|
||||
}
|
||||
|
||||
@objc func markRead(_ sender: Any?) {
|
||||
coordinator.markAsReadForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func markUnreadAndGoToNextUnread(_ sender: Any?) {
|
||||
coordinator.markAsUnreadForCurrentArticle()
|
||||
coordinator.selectNextUnread()
|
||||
}
|
||||
|
||||
@objc func markAllAsReadAndGoToNextUnread(_ sender: Any?) {
|
||||
coordinator.markAllAsReadInTimeline()
|
||||
coordinator.selectNextUnread()
|
||||
}
|
||||
|
||||
@objc func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
coordinator.markAsReadOlderArticlesInTimeline()
|
||||
}
|
||||
|
||||
@objc func markUnread(_ sender: Any?) {
|
||||
coordinator.markAsUnreadForCurrentArticle()
|
||||
}
|
||||
|
||||
@objc func goToPreviousSubscription(_ sender: Any?) {
|
||||
|
|
|
@ -731,6 +731,11 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
masterNavigationController.popViewController(animated: true)
|
||||
}
|
||||
|
||||
func markAsReadOlderArticlesInTimeline() {
|
||||
if let indexPath = currentArticleIndexPath {
|
||||
markAsReadOlderArticlesInTimeline(indexPath)
|
||||
}
|
||||
}
|
||||
func markAsReadOlderArticlesInTimeline(_ indexPath: IndexPath) {
|
||||
let article = articles[indexPath.row]
|
||||
let articlesToMark = articles.filter { $0.logicalDatePublished < article.logicalDatePublished }
|
||||
|
@ -740,6 +745,18 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
markAllAsRead(articlesToMark)
|
||||
}
|
||||
|
||||
func markAsReadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
markArticles(Set([article]), statusKey: .read, flag: true)
|
||||
}
|
||||
}
|
||||
|
||||
func markAsUnreadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
markArticles(Set([article]), statusKey: .read, flag: false)
|
||||
}
|
||||
}
|
||||
|
||||
func toggleReadForCurrentArticle() {
|
||||
if let article = currentArticle {
|
||||
markArticles(Set([article]), statusKey: .read, flag: !article.status.read)
|
||||
|
|
Loading…
Reference in New Issue