Mark articles read on scroll every time. Fixes bug where undo marked as unread, and we scrolled past again.

This commit is contained in:
Brent Simmons committed 2026-12-05 10:42:00 -08:00
1 parent 2f9fdd08b7
commit 0187681bb8
2 files changed
+2 -10

No files matched your search

@@ -73,7 +73,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
if !representedObjectArraysAreEqual(oldValue, representedObjects) {
seedReadFilterForFolders()
unreadCount = 0
articleKeysMarkedReadOnScroll.removeAll()
updateNextUnreadFooter()
selectionDidChange(nil)
@@ -296,8 +295,6 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
private var isLiveScrolling = false
/// Rows wholly above the visible area at the last check. Rows past this count are newly scrolled past.
private var rowCountScrolledPast = 0
/// An article is marked read on scroll only once, so one the user marks unread again stays unread.
private var articleKeysMarkedReadOnScroll = Set<ArticleIdentityKey>()
private var articlesPendingMarkReadOnScroll = [Article]()
/// Marking waits for a pause in scrolling, so one Undo restores what one stretch of scrolling marked.
private static let markReadOnScrollDelay: TimeInterval = 0.5
@@ -1689,7 +1686,7 @@ private extension TimelineViewController {
guard let article = articles.articleAtRow(row), !article.status.read else {
continue
}
if articleKeysMarkedReadOnScroll.insert(ArticleIdentityKey(article)).inserted {
if !articlesPendingMarkReadOnScroll.contains(article) {
articlesPendingMarkReadOnScroll.append(article)
}
}
@@ -37,8 +37,6 @@ final class MainTimelineViewController: UIViewController, UndoableCommandRunner
}
/// Rows under the navigation bar or above it at the last check. Rows past this count are newly scrolled past.
private var rowCountScrolledPast = 0
/// An article is marked read on scroll only once, so one the user marks unread again stays unread.
private var articlesMarkedReadOnScroll = Set<ArticleSpecifier>()
private var articlesPendingMarkReadOnScroll = [Article]()
/// Shown in the footer after the last row. Nil hides the footer’s button.
private var nextSidebarItemWithUnreadArticles: SidebarItem?
@@ -366,9 +364,6 @@ final class MainTimelineViewController: UIViewController, UndoableCommandRunner
guard isViewLoaded else {
return
}
if resetScroll {
articlesMarkedReadOnScroll.removeAll()
}
resetUI(resetScroll: resetScroll)
restoreSelectionIfNecessary(adjustScroll: false)
updateNextUnreadFooter()
@@ -1222,7 +1217,7 @@ private extension MainTimelineViewController {
guard let article = dataSource.itemIdentifier(for: IndexPath(item: item, section: 0)), !article.status.read else {
continue
}
if articlesMarkedReadOnScroll.insert(ArticleSpecifier(article: article)).inserted {
if !articlesPendingMarkReadOnScroll.contains(article) {
articlesPendingMarkReadOnScroll.append(article)
}
}