Revert code to not use cell prefetching on iOS 15. Fixes #3446

This commit is contained in:
Maurice Parker 2022-02-08 11:57:44 -08:00
parent 8ad5969452
commit a9df2fb376

View File

@ -79,6 +79,9 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
// Configure the table
tableView.dataSource = dataSource
if #available(iOS 15.0, *) {
tableView.isPrefetchingEnabled = false
}
numberOfTextLines = AppDefaults.shared.timelineNumberOfLines
iconSize = AppDefaults.shared.timelineIconSize
resetEstimatedRowHeight()
@ -525,12 +528,8 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
}
@objc private func reloadAllVisibleCells() {
if #available(iOS 15, *) {
reconfigureCells(coordinator.articles)
} else {
let visibleArticles = tableView.indexPathsForVisibleRows!.compactMap { return dataSource.itemIdentifier(for: $0) }
reloadCells(visibleArticles)
}
let visibleArticles = tableView.indexPathsForVisibleRows!.compactMap { return dataSource.itemIdentifier(for: $0) }
reloadCells(visibleArticles)
}
private func reloadCells(_ articles: [Article]) {
@ -541,15 +540,6 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
}
}
private func reconfigureCells(_ articles: [Article]) {
guard #available(iOS 15, *) else { return }
var snapshot = dataSource.snapshot()
snapshot.reconfigureItems(articles)
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
self?.restoreSelectionIfNecessary(adjustScroll: false)
}
}
// MARK: Cell Configuring
private func resetEstimatedRowHeight() {