Clear undoableCommands when the articles array changes.
This commit is contained in:
parent
5f848f568a
commit
9fbce42959
|
@ -27,9 +27,12 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
|
||||
private var articles = [Article]() {
|
||||
didSet {
|
||||
if articles != oldValue {
|
||||
clearUndoableCommands()
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var representedObjects: [AnyObject]? {
|
||||
didSet {
|
||||
|
@ -123,10 +126,16 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
guard let undoManager = undoManager, let markAllReadCommand = MarkAllReadCommand(initialArticles: articles, undoManager: undoManager) else {
|
||||
return
|
||||
}
|
||||
markAllReadCommand.perform()
|
||||
runCommand(markAllReadCommand)
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
// MARK: - Undoable Commands
|
||||
|
||||
private func runCommand(_ undoableCommand: UndoableCommand) {
|
||||
|
||||
pushUndoableCommand(undoableCommand)
|
||||
undoableCommand.perform()
|
||||
}
|
||||
|
||||
private func pushUndoableCommand(_ undoableCommand: UndoableCommand) {
|
||||
|
||||
|
@ -147,6 +156,8 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||
undoableCommands = [UndoableCommand]()
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
||||
|
||||
if let link = oneSelectedArticle?.preferredLink {
|
||||
|
|
Loading…
Reference in New Issue