From fc58791e5e8c3cfe5c30856ad95a67b648268c4d Mon Sep 17 00:00:00 2001 From: Yusuf Suleman Date: Fri, 3 Apr 2026 21:06:17 -0500 Subject: [PATCH] fix: remove broken mark-as-read on scroll entirely onDisappear fires when scrolling in BOTH directions and when navigating, making it impossible to reliably detect scroll direction. Reverted to simple behavior: articles only mark as read when you tap into them (handled in ArticleView). Will revisit mark-on-scroll with a proper ScrollViewReader approach later. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Features/Reader/Views/EntryListView.swift | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/ios/Platform/Platform/Features/Reader/Views/EntryListView.swift b/ios/Platform/Platform/Features/Reader/Views/EntryListView.swift index e1f0a40..ba3a8af 100644 --- a/ios/Platform/Platform/Features/Reader/Views/EntryListView.swift +++ b/ios/Platform/Platform/Features/Reader/Views/EntryListView.swift @@ -3,12 +3,11 @@ import SwiftUI struct EntryListView: View { @Bindable var vm: ReaderViewModel var isCardView: Bool = true - @State private var visibleEntryIDs: Set = [] - @State private var readByScrollIDs: Set = [] var body: some View { if vm.isLoading && vm.entries.isEmpty { LoadingView() + .frame(maxWidth: .infinity, maxHeight: .infinity) } else if vm.entries.isEmpty { EmptyStateView( icon: "newspaper", @@ -17,6 +16,7 @@ struct EntryListView: View { ? "Star articles to save them here" : "All caught up!" ) + .frame(maxWidth: .infinity, maxHeight: .infinity) } else { ScrollView { if isCardView { @@ -44,8 +44,6 @@ struct EntryListView: View { } .buttonStyle(.plain) .contentShape(Rectangle()) - .onAppear { visibleEntryIDs.insert(entry.id) } - .onDisappear { markReadIfScrolled(entry) } .contextMenu { entryContextMenu(entry: entry, vm: vm) } @@ -69,8 +67,6 @@ struct EntryListView: View { } .buttonStyle(.plain) .contentShape(Rectangle()) - .onAppear { visibleEntryIDs.insert(entry.id) } - .onDisappear { markReadIfScrolled(entry) } .contextMenu { entryContextMenu(entry: entry, vm: vm) } @@ -85,24 +81,6 @@ struct EntryListView: View { } } - // MARK: - Mark as read on scroll - - /// Only mark as read if the entry was visible before AND has scrolled off - /// while other entries are still visible (i.e. user is scrolling, not navigating away) - private func markReadIfScrolled(_ entry: ReaderEntry) { - // Remove from visible set - visibleEntryIDs.remove(entry.id) - - // If there are still visible entries, user is scrolling (not navigating) - // and this entry scrolled off → mark as read - guard !visibleEntryIDs.isEmpty else { return } - guard !entry.isRead else { return } - guard !readByScrollIDs.contains(entry.id) else { return } - - readByScrollIDs.insert(entry.id) - Task { await vm.markAsRead(entry) } - } - private var loadMoreTrigger: some View { Group { if vm.isLoadingMore {