Always updates the tree controller when collapsing and expanding. Fixes #3040
This commit is contained in:
parent
7e689d2eb1
commit
168020cba2
|
@ -511,33 +511,21 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
|||
@objc func expandSelectedRows(_ sender: Any?) {
|
||||
if let indexPath = coordinator.currentFeedIndexPath, let containerID = dataSource.itemIdentifier(for: indexPath)?.containerID {
|
||||
coordinator.expand(containerID)
|
||||
self.applyChanges(animated: true) {
|
||||
self.reloadAllVisibleCells()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc func collapseSelectedRows(_ sender: Any?) {
|
||||
if let indexPath = coordinator.currentFeedIndexPath, let containerID = dataSource.itemIdentifier(for: indexPath)?.containerID {
|
||||
coordinator.collapse(containerID)
|
||||
self.applyChanges(animated: true) {
|
||||
self.reloadAllVisibleCells()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc func expandAll(_ sender: Any?) {
|
||||
coordinator.expandAllSectionsAndFolders()
|
||||
self.applyChanges(animated: true) {
|
||||
self.reloadAllVisibleCells()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func collapseAllExceptForGroupItems(_ sender: Any?) {
|
||||
coordinator.collapseAllFolders()
|
||||
self.applyChanges(animated: true) {
|
||||
self.reloadAllVisibleCells()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func markAllAsRead(_ sender: Any) {
|
||||
|
@ -917,11 +905,9 @@ private extension MasterFeedViewController {
|
|||
if coordinator.isExpanded(sectionNode) {
|
||||
headerView.disclosureExpanded = false
|
||||
coordinator.collapse(sectionNode)
|
||||
self.applyChanges(animated: true)
|
||||
} else {
|
||||
headerView.disclosureExpanded = true
|
||||
coordinator.expand(sectionNode)
|
||||
self.applyChanges(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -930,7 +916,6 @@ private extension MasterFeedViewController {
|
|||
return
|
||||
}
|
||||
coordinator.expand(containerID)
|
||||
applyChanges(animated: true)
|
||||
}
|
||||
|
||||
func collapse(_ cell: MasterFeedTableViewCell) {
|
||||
|
@ -938,7 +923,6 @@ private extension MasterFeedViewController {
|
|||
return
|
||||
}
|
||||
coordinator.collapse(containerID)
|
||||
applyChanges(animated: true)
|
||||
}
|
||||
|
||||
func makeWebFeedContextMenu(identifier: MasterFeedTableViewIdentifier, indexPath: IndexPath, includeDeleteRename: Bool) -> UIContextMenuConfiguration {
|
||||
|
|
|
@ -72,7 +72,6 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
private var fetchSerialNumber = 0
|
||||
private let fetchRequestQueue = FetchRequestQueue()
|
||||
|
||||
private var animatingChanges = false
|
||||
private var expandedTable = Set<ContainerIdentifier>()
|
||||
private var readFilterEnabledTable = [FeedIdentifier: Bool]()
|
||||
private var shadowTable = [[Node]]()
|
||||
|
@ -446,6 +445,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
return
|
||||
}
|
||||
|
||||
guard note.object is Feed else { return }
|
||||
|
||||
queueRebuildBackingStores()
|
||||
}
|
||||
|
||||
|
@ -677,9 +678,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
|
||||
func expand(_ containerID: ContainerIdentifier) {
|
||||
markExpanded(containerID)
|
||||
animatingChanges = true
|
||||
rebuildShadowTable()
|
||||
animatingChanges = false
|
||||
rebuildBackingStores()
|
||||
}
|
||||
|
||||
func expand(_ node: Node) {
|
||||
|
@ -696,16 +695,12 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
animatingChanges = true
|
||||
rebuildShadowTable()
|
||||
animatingChanges = false
|
||||
rebuildBackingStores()
|
||||
}
|
||||
|
||||
func collapse(_ containerID: ContainerIdentifier) {
|
||||
unmarkExpanded(containerID)
|
||||
animatingChanges = true
|
||||
rebuildShadowTable()
|
||||
animatingChanges = false
|
||||
rebuildBackingStores()
|
||||
clearTimelineIfNoLongerAvailable()
|
||||
}
|
||||
|
||||
|
@ -716,16 +711,13 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
|
||||
func collapseAllFolders() {
|
||||
for sectionNode in treeController.rootNode.childNodes {
|
||||
unmarkExpanded(sectionNode)
|
||||
for topLevelNode in sectionNode.childNodes {
|
||||
if topLevelNode.representedObject is Folder {
|
||||
unmarkExpanded(topLevelNode)
|
||||
}
|
||||
}
|
||||
}
|
||||
animatingChanges = true
|
||||
rebuildShadowTable()
|
||||
animatingChanges = false
|
||||
rebuildBackingStores()
|
||||
clearTimelineIfNoLongerAvailable()
|
||||
}
|
||||
|
||||
|
@ -1446,7 +1438,7 @@ private extension SceneCoordinator {
|
|||
}
|
||||
|
||||
func rebuildBackingStores(initialLoad: Bool = false, updateExpandedNodes: (() -> Void)? = nil, completion: (() -> Void)? = nil) {
|
||||
if !animatingChanges && !BatchUpdate.shared.isPerforming {
|
||||
if !BatchUpdate.shared.isPerforming {
|
||||
|
||||
addToFilterExeptionsIfNecessary(timelineFeed)
|
||||
treeController.rebuild()
|
||||
|
|
Loading…
Reference in New Issue