Check if the split is collapsed to see if we are maintaining the selection
This commit is contained in:
parent
aa7c60ee3a
commit
c8b5b10edd
|
@ -432,7 +432,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
// MARK: API
|
||||
|
||||
func updateFeedSelection() {
|
||||
guard traitCollection.userInterfaceIdiom == .pad else {
|
||||
guard !coordinator.isRootSplitCollapsed else {
|
||||
return
|
||||
}
|
||||
if let indexPath = coordinator.currentFeedIndexPath {
|
||||
|
@ -628,7 +628,9 @@ private extension MasterFeedViewController {
|
|||
private func reloadCells(_ nodes: [Node]) {
|
||||
var snapshot = dataSource.snapshot()
|
||||
snapshot.reloadItems(nodes)
|
||||
dataSource.apply(snapshot, animatingDifferences: false)
|
||||
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
|
||||
self?.restoreSelectionIfNecessary()
|
||||
}
|
||||
}
|
||||
|
||||
private func accountForNode(_ node: Node) -> Account? {
|
||||
|
@ -661,7 +663,7 @@ private extension MasterFeedViewController {
|
|||
}
|
||||
|
||||
func restoreSelectionIfNecessary() {
|
||||
guard traitCollection.userInterfaceIdiom == .pad else {
|
||||
guard !coordinator.isRootSplitCollapsed else {
|
||||
return
|
||||
}
|
||||
if let indexPath = coordinator.masterFeedIndexPathForCurrentTimeline(), indexPath != tableView.indexPathForSelectedRow {
|
||||
|
|
|
@ -156,7 +156,7 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
}
|
||||
|
||||
func updateArticleSelection(animate: Bool) {
|
||||
guard traitCollection.userInterfaceIdiom == .pad && !coordinator.articles.isEmpty else {
|
||||
guard !coordinator.isRootSplitCollapsed && !coordinator.articles.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ private extension MasterTimelineViewController {
|
|||
}
|
||||
|
||||
func restoreSelectionIfNecessary() {
|
||||
guard traitCollection.userInterfaceIdiom == .pad else {
|
||||
guard !coordinator.isRootSplitCollapsed else {
|
||||
return
|
||||
}
|
||||
if let articleID = coordinator.currentArticle?.articleID, let index = coordinator.indexForArticleID(articleID) {
|
||||
|
|
Loading…
Reference in New Issue