From 0187681bb876d1dee87f9eb156a6868c56220c04 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 5 Dec 2026 10:42:00 -0800 Subject: [PATCH] Mark articles read on scroll every time. Fixes bug where undo marked as unread, and we scrolled past again. --- Mac/MainWindow/Timeline/TimelineViewController.swift | 5 +---- iOS/MainTimeline/MainTimelineViewController.swift | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index bebb5e2f3..ee973c605 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -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() 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) } } diff --git a/iOS/MainTimeline/MainTimelineViewController.swift b/iOS/MainTimeline/MainTimelineViewController.swift index 80da24f36..2bd9d7c22 100644 --- a/iOS/MainTimeline/MainTimelineViewController.swift +++ b/iOS/MainTimeline/MainTimelineViewController.swift @@ -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() 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) } }