mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Do not mark articles as read on scroll when they were manually toggled
This commit is contained in:
@@ -111,6 +111,9 @@ private extension TimelineViewController {
|
||||
|
||||
func markArticles(_ articles: [Article], read: Bool) {
|
||||
markArticles(articles, statusKey: .read, flag: read)
|
||||
for article in articles {
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
func markArticles(_ articles: [Article], starred: Bool) {
|
||||
|
||||
@@ -138,6 +138,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
}
|
||||
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
|
||||
var articlesWithManuallyChangedReadStatus: Set<Article> = Set()
|
||||
|
||||
private var fetchSerialNumber = 0
|
||||
private let fetchRequestQueue = FetchRequestQueue()
|
||||
private var exceptionArticleFetcher: ArticleFetcher?
|
||||
@@ -341,7 +344,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
return
|
||||
}
|
||||
let firstVisibleRowIndex = tableView.rows(in: tableView.visibleRect).location
|
||||
guard let unreadArticlesScrolledAway = articles.articlesAbove(position: firstVisibleRowIndex).unreadArticles() else { return }
|
||||
let unreadArticlesScrolledAway = articles.articlesAbove(position: firstVisibleRowIndex).filter { !$0.status.read && !articlesWithManuallyChangedReadStatus.contains($0) }
|
||||
|
||||
if unreadArticlesScrolledAway.isEmpty { return }
|
||||
|
||||
guard let undoManager = undoManager, let markReadCommand = MarkStatusCommand(initialArticles: unreadArticlesScrolledAway, markingRead: true, undoManager: undoManager) else {
|
||||
return
|
||||
@@ -370,6 +375,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
return
|
||||
}
|
||||
runCommand(markReadCommand)
|
||||
for article in selectedArticles {
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func markSelectedArticlesAsUnread(_ sender: Any?) {
|
||||
@@ -377,6 +385,9 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
return
|
||||
}
|
||||
runCommand(markUnreadCommand)
|
||||
for article in selectedArticles {
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func copy(_ sender: Any?) {
|
||||
@@ -928,6 +939,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
return
|
||||
}
|
||||
self.runCommand(markUnreadCommand)
|
||||
articlesWithManuallyChangedReadStatus.insert(article)
|
||||
}
|
||||
|
||||
private func toggleArticleStarred(_ article: Article) {
|
||||
|
||||
Reference in New Issue
Block a user