Move more logic out of MasterTimelineViewController and into AppCoordinator

This commit is contained in:
Maurice Parker 2019-07-06 12:31:07 -05:00
parent 6e59c56515
commit 8b6e2fa517
2 changed files with 10 additions and 10 deletions

View File

@ -505,6 +505,15 @@ class AppCoordinator: UndoableCommandRunner {
runCommand(markReadCommand)
}
func markAllAsReadInTimeline() {
guard let undoManager = undoManager,
let markReadCommand = MarkStatusCommand(initialArticles: articles, markingRead: true, undoManager: undoManager) else {
return
}
runCommand(markReadCommand)
masterNavigationController.popViewController(animated: true)
}
func toggleReadForCurrentArticle() {
if let article = currentArticle {
markArticles(Set([article]), statusKey: .read, flag: !article.status.read)

View File

@ -90,16 +90,7 @@ class MasterTimelineViewController: ProgressTableViewController, UndoableCommand
let markTitle = NSLocalizedString("Mark All Read", comment: "Mark All Read")
let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in
guard let articles = self?.coordinator.articles,
let undoManager = self?.undoManager,
let markReadCommand = MarkStatusCommand(initialArticles: articles, markingRead: true, undoManager: undoManager) else {
return
}
self?.runCommand(markReadCommand)
self?.navigationController?.popViewController(animated: true)
self?.coordinator.markAllAsReadInTimeline()
}
alertController.addAction(markAction)