Prevent selecting of items that may not show the current article selection as is done on the iPhone

This commit is contained in:
Maurice Parker 2019-08-29 17:49:21 -05:00
parent 3b31a4f21d
commit 86a302f787

View File

@ -475,9 +475,16 @@ private extension MasterTimelineViewController {
}
func performBlockAndRestoreSelection(_ block: (() -> Void)) {
let article = coordinator.currentArticle
let articleID: String? = {
if let indexPath = tableView.indexPathForSelectedRow, indexPath.row < coordinator.articles.count {
return coordinator.articles[indexPath.row].articleID
}
return nil
}()
block()
if let articleID = article?.articleID, let index = coordinator.indexesForArticleIDs(Set([articleID])).first {
if let articleID = articleID, let index = coordinator.indexesForArticleIDs(Set([articleID])).first {
let indexPath = IndexPath(row: index, section: 0)
tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none)
}