diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index c1d1c3ef2..bd35944da 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -35,7 +35,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner weak var coordinator: SceneCoordinator! var undoableCommands = [UndoableCommand]() - let scrollPositionQueue = CoalescingQueue(name: "Timeline Scroll Position", interval: 0.3, maxInterval: 1.0) private let keyboardManager = KeyboardManager(type: .timeline) override var keyCommands: [UIKeyCommand]? { @@ -433,21 +432,26 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner coordinator.selectArticle(article, animations: [.scroll, .select, .navigation]) } - override func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) { + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + coordinator.timelineMiddleIndexPath = tableView.middleVisibleRow() + + // Implement Mark As Read on Scroll where we mark after the leading edge goes a little beyond the safe area inset guard AppDefaults.shared.markArticlesAsReadOnScroll, - let firstVisible = tableView.indexPathsForVisibleRows?.first, - indexPath < firstVisible, - let article = dataSource.itemIdentifier(for: indexPath), - article.status.read == false, - !coordinator.directlyMarkedAsUnreadArticles.contains(article) else { - return + let firstVisibleindexPath = tableView.indexPathsForVisibleRows?.first else { return } + + var articles = [Article]() + for i in firstVisibleindexPath.row..