Implement markOlderArticlesAsRead. Fix #199.
This commit is contained in:
parent
6a09a2d6ef
commit
c38b46a29e
|
@ -86,11 +86,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
addFolderWindowController!.runSheetOnWindow(window)
|
||||
}
|
||||
|
||||
func markOlderArticlesAsRead(with window: NSWindow) {
|
||||
|
||||
panicButtonWindowController = PanicButtonWindowController()
|
||||
panicButtonWindowController!.runSheetOnWindow(window)
|
||||
}
|
||||
// func markOlderArticlesAsRead(with window: NSWindow) {
|
||||
//
|
||||
// panicButtonWindowController = PanicButtonWindowController()
|
||||
// panicButtonWindowController!.runSheetOnWindow(window)
|
||||
// }
|
||||
|
||||
func markEverywhereAsRead(with window: NSWindow) {
|
||||
|
||||
|
@ -431,11 +431,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
|
|||
Browser.open("https://ranchero.com/evergreen/help/1.0/", inBackground: false)
|
||||
}
|
||||
|
||||
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
|
||||
createAndShowMainWindow()
|
||||
markOlderArticlesAsRead(with: mainWindowController!.window!)
|
||||
}
|
||||
// @IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
//
|
||||
// createAndShowMainWindow()
|
||||
// markOlderArticlesAsRead(with: mainWindowController!.window!)
|
||||
// }
|
||||
|
||||
@IBAction func markEverywhereAsRead(_ sender: Any?) {
|
||||
|
||||
|
|
|
@ -239,7 +239,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||
|
||||
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
|
||||
appDelegate.markOlderArticlesAsRead(with: window!)
|
||||
timelineViewController?.markOlderArticlesAsRead(sender)
|
||||
// appDelegate.markOlderArticlesAsRead(with: window!)
|
||||
}
|
||||
|
||||
@IBAction func markEverywhereAsRead(_ sender: Any?) {
|
||||
|
|
|
@ -180,6 +180,34 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||
runCommand(markUnreadCommand)
|
||||
}
|
||||
|
||||
@IBAction func markOlderArticlesAsRead(_ sender: Any?) {
|
||||
|
||||
// Mark articles the same age or older than the selected article(s) as read.
|
||||
|
||||
var cutoffDate: Date? = nil
|
||||
for article in selectedArticles {
|
||||
if cutoffDate == nil {
|
||||
cutoffDate = article.logicalDatePublished
|
||||
}
|
||||
else if cutoffDate! < article.logicalDatePublished {
|
||||
cutoffDate = article.logicalDatePublished
|
||||
}
|
||||
}
|
||||
if cutoffDate == nil {
|
||||
return
|
||||
}
|
||||
|
||||
let articlesToMark = articles.filter { $0.logicalDatePublished <= cutoffDate! }
|
||||
if articlesToMark.isEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
guard let undoManager = undoManager, let markReadCommand = MarkReadOrUnreadCommand(initialArticles: articlesToMark, markingRead: true, undoManager: undoManager) else {
|
||||
return
|
||||
}
|
||||
runCommand(markReadCommand)
|
||||
}
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
func goToNextUnread() {
|
||||
|
|
Loading…
Reference in New Issue