Fix select position getting lost on refreshes

This commit is contained in:
Maurice Parker 2019-08-29 11:53:36 -05:00
parent be8c14bc65
commit 379ba49fd5
1 changed files with 4 additions and 3 deletions

View File

@ -475,10 +475,11 @@ private extension MasterTimelineViewController {
}
func performBlockAndRestoreSelection(_ block: (() -> Void)) {
let indexPaths = tableView.indexPathsForSelectedRows
let article = coordinator.currentArticle
block()
indexPaths?.forEach { [weak self] indexPath in
self?.tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
if let articleID = article?.articleID, let index = coordinator.indexesForArticleIDs(Set([articleID])).first {
let indexPath = IndexPath(row: index, section: 0)
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .middle)
}
}