Make table views scroll even if the root split is collapsed

This commit is contained in:
Maurice Parker 2019-09-08 08:30:08 -05:00
parent 5bfeb77706
commit 8b901819a6
3 changed files with 5 additions and 18 deletions

View File

@ -434,12 +434,9 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
// MARK: API
func updateFeedSelection() {
guard !coordinator.isRootSplitCollapsed else {
return
}
if let indexPath = coordinator.currentFeedIndexPath {
if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
}
} else {
tableView.selectRow(at: nil, animated: true, scrollPosition: .none)
@ -665,11 +662,8 @@ private extension MasterFeedViewController {
}
func restoreSelectionIfNecessary() {
guard !coordinator.isRootSplitCollapsed else {
return
}
if let indexPath = coordinator.masterFeedIndexPathForCurrentTimeline(), indexPath != tableView.indexPathForSelectedRow {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
}
}

View File

@ -156,13 +156,9 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
}
func updateArticleSelection(animate: Bool) {
guard !coordinator.isRootSplitCollapsed && !coordinator.articles.isEmpty else {
return
}
if let indexPath = coordinator.currentArticleIndexPath {
if tableView.indexPathForSelectedRow != indexPath {
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: true, deselect: coordinator.isRootSplitCollapsed)
}
} else {
tableView.selectRow(at: nil, animated: animate, scrollPosition: .none)
@ -533,12 +529,9 @@ private extension MasterTimelineViewController {
}
func restoreSelectionIfNecessary() {
guard !coordinator.isRootSplitCollapsed else {
return
}
if let articleID = coordinator.currentArticle?.articleID, let index = coordinator.indexForArticleID(articleID) {
let indexPath = IndexPath(row: index, section: 0)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
}
}

@ -1 +1 @@
Subproject commit 3e0dbb1c0a88697e7be510da0226fe1e3e7ef195
Subproject commit 7af10d021f35df5596fa898ba55f5173fcb0e26b