Keep track of when article view was pushed, so timeline deselects only in case where article view was popped.

This commit is contained in:
Brent Simmons committed 2026-01-31 08:18:32 -08:00
1 parent 285c42f11a
commit 97a76336b5
2 files changed
+12 -6

No files matched your search

@@ -30,6 +30,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR
private lazy var filterButton = UIBarButtonItem(image: Assets.Images.filter, style: .plain, target: self, action: #selector(toggleFilter(_:)))
private lazy var firstUnreadButton = UIBarButtonItem(image: Assets.Images.nextUnread, style: .plain, target: self, action: #selector(firstUnread(_:)))
private var dataSource: UICollectionViewDiffableDataSource<Int, Article>?
var didPushArticleViewController = false
private var timelineFeed: SidebarItem? {
assert(coordinator != nil)
@@ -216,12 +217,16 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR
self.navigationController?.navigationBar.alpha = 1
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
self.deselectIfNecessary()
})
// Deselect only when returning from article navigation
if didPushArticleViewController {
didPushArticleViewController = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
self.deselectIfNecessary()
}
}
}
func deselectIfNecessary() {
guard traitCollection.userInterfaceIdiom == .phone else {
return
@@ -234,7 +239,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR
coordinator?.selectArticle(nil)
}
}
func restoreSelectionIfNecessary(adjustScroll: Bool) {
Self.logger.debug("MainTimelineModernViewController: restoreSelectionIfNecessary")
guard let collectionView else {
+1
View File
@@ -1023,6 +1023,7 @@ struct SidebarItemNode: Hashable, Sendable {
}
rootSplitViewController.show(.secondary)
mainTimelineViewController?.didPushArticleViewController = true
// Mark article as read before navigating to it, so the read status does not flash unread/read on display
markArticles(Set([article!]), statusKey: .read, flag: true)