diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 78f5e919b..a74a96021 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -137,9 +137,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner // MARK: API - func restoreSelectionIfNecessary() { + func restoreSelectionIfNecessary(adjustScroll: Bool) { if let article = coordinator.currentArticle, let indexPath = dataSource.indexPath(for: article) { - tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed) + if adjustScroll { + tableView.selectRowAndScrollIfNotVisible(at: indexPath, animated: false, deselect: coordinator.isRootSplitCollapsed) + } else { + tableView.selectRow(at: indexPath, animated: false, scrollPosition: .none) + } } } @@ -390,7 +394,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner var snapshot = dataSource.snapshot() snapshot.reloadItems(articles) dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in - self?.restoreSelectionIfNecessary() + self?.restoreSelectionIfNecessary(adjustScroll: false) } } @@ -507,7 +511,7 @@ private extension MasterTimelineViewController { snapshot.appendItems(coordinator.articles, toSection: 0) dataSource.apply(snapshot, animatingDifferences: animate) { [weak self] in - self?.restoreSelectionIfNecessary() + self?.restoreSelectionIfNecessary(adjustScroll: false) completion?() } } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 9a845871d..1a54b158a 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1516,7 +1516,7 @@ private extension SceneCoordinator { subSplitViewController!.showDetailViewController(navController, sender: self) masterFeedViewController.restoreSelectionIfNecessary(adjustScroll: true) - masterTimelineViewController!.restoreSelectionIfNecessary() + masterTimelineViewController!.restoreSelectionIfNecessary(adjustScroll: true) // We made sure this was there above when we called configureDoubleSplit return subSplitViewController!