Restore the timeline selection lost while transitioning to three panel mode

This commit is contained in:
Maurice Parker 2019-09-10 08:06:43 -05:00
parent 2b17735cb0
commit bceccd76b5
2 changed files with 9 additions and 7 deletions

View File

@ -145,6 +145,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
// MARK: API
func restoreSelectionIfNecessary() {
if let articleID = coordinator.currentArticle?.articleID, let index = coordinator.indexForArticleID(articleID) {
let indexPath = IndexPath(row: index, section: 0)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
}
}
func reinitializeArticles() {
resetUI()
}
@ -527,13 +534,6 @@ private extension MasterTimelineViewController {
}
return nil
}
func restoreSelectionIfNecessary() {
if let articleID = coordinator.currentArticle?.articleID, let index = coordinator.indexForArticleID(articleID) {
let indexPath = IndexPath(row: index, section: 0)
tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed)
}
}
func toggleArticleReadStatusAction(indexPath: IndexPath) -> UIAction {
let article = coordinator.articles[indexPath.row]

View File

@ -1620,6 +1620,8 @@ private extension SceneCoordinator {
let navController = addNavControllerIfNecessary(controller, showButton: false)
subSplitViewController!.showDetailViewController(navController, sender: self)
masterTimelineViewController!.restoreSelectionIfNecessary()
// Return the shim controller
return subSplitViewController!.parent!