Avoid redundant shadow table rebuilds when auto-expanding containers.
This commit is contained in:
parent
f1de105a65
commit
f79eaf7c19
|
@ -405,7 +405,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectFirstUnreadInAllUnread() {
|
func selectFirstUnreadInAllUnread() {
|
||||||
expand(SmartFeedsController.shared)
|
markExpanded(SmartFeedsController.shared)
|
||||||
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) {
|
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) {
|
||||||
self.selectFeed(SmartFeedsController.shared.unreadFeed) {
|
self.selectFeed(SmartFeedsController.shared.unreadFeed) {
|
||||||
self.selectFirstUnreadArticleInTimeline()
|
self.selectFirstUnreadArticleInTimeline()
|
||||||
|
@ -646,21 +646,17 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func expand(_ containerIdentifiable: ContainerIdentifiable) {
|
func expand(_ node: Node) {
|
||||||
guard !isExpanded(containerIdentifiable) else { return }
|
guard let containerIdentifiable = node.representedObject as? ContainerIdentifiable else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
markExpanded(containerIdentifiable)
|
markExpanded(containerIdentifiable)
|
||||||
animatingChanges = true
|
animatingChanges = true
|
||||||
rebuildShadowTable()
|
rebuildShadowTable()
|
||||||
animatingChanges = false
|
animatingChanges = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func expand(_ node: Node) {
|
|
||||||
if let containerIdentifiable = node.representedObject as? ContainerIdentifiable {
|
|
||||||
expand(containerIdentifiable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func expandAllSectionsAndFolders() {
|
func expandAllSectionsAndFolders() {
|
||||||
for sectionNode in treeController.rootNode.childNodes {
|
for sectionNode in treeController.rootNode.childNodes {
|
||||||
markExpanded(sectionNode)
|
markExpanded(sectionNode)
|
||||||
|
@ -764,21 +760,21 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectTodayFeed() {
|
func selectTodayFeed() {
|
||||||
expand(SmartFeedsController.shared)
|
markExpanded(SmartFeedsController.shared)
|
||||||
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.todayFeed) {
|
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.todayFeed) {
|
||||||
self.selectFeed(SmartFeedsController.shared.todayFeed, animations: [.navigation, .scroll])
|
self.selectFeed(SmartFeedsController.shared.todayFeed, animations: [.navigation, .scroll])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectAllUnreadFeed() {
|
func selectAllUnreadFeed() {
|
||||||
expand(SmartFeedsController.shared)
|
markExpanded(SmartFeedsController.shared)
|
||||||
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) {
|
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.unreadFeed) {
|
||||||
self.selectFeed(SmartFeedsController.shared.unreadFeed, animations: [.navigation, .scroll])
|
self.selectFeed(SmartFeedsController.shared.unreadFeed, animations: [.navigation, .scroll])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func selectStarredFeed() {
|
func selectStarredFeed() {
|
||||||
expand(SmartFeedsController.shared)
|
markExpanded(SmartFeedsController.shared)
|
||||||
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.starredFeed) {
|
self.ensureFeedIsAvailableToSelect(SmartFeedsController.shared.starredFeed) {
|
||||||
self.selectFeed(SmartFeedsController.shared.starredFeed, animations: [.navigation, .scroll])
|
self.selectFeed(SmartFeedsController.shared.starredFeed, animations: [.navigation, .scroll])
|
||||||
}
|
}
|
||||||
|
@ -1045,9 +1041,9 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||||
|
|
||||||
let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(webFeed) })
|
let parentFolder = account.sortedFolders?.first(where: { $0.objectIsChild(webFeed) })
|
||||||
|
|
||||||
expand(account)
|
markExpanded(account)
|
||||||
if let parentFolder = parentFolder {
|
if let parentFolder = parentFolder {
|
||||||
expand(parentFolder)
|
markExpanded(parentFolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let webFeedFeedID = webFeed.feedID {
|
if let webFeedFeedID = webFeed.feedID {
|
||||||
|
@ -1304,7 +1300,7 @@ private extension SceneCoordinator {
|
||||||
articleDictionaryNeedsUpdate = false
|
articleDictionaryNeedsUpdate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureFeedIsAvailableToSelect(_ feed: Feed, completion: @escaping () -> Void) {
|
func ensureFeedIsAvailableToSelect(_ feed: Feed, completion: @escaping () -> Void) {
|
||||||
addToFilterExeptionsIfNecessary(feed)
|
addToFilterExeptionsIfNecessary(feed)
|
||||||
addShadowTableToFilterExceptions()
|
addShadowTableToFilterExceptions()
|
||||||
|
|
||||||
|
@ -2012,7 +2008,7 @@ private extension SceneCoordinator {
|
||||||
case .smartFeed:
|
case .smartFeed:
|
||||||
guard let smartFeed = SmartFeedsController.shared.find(by: feedIdentifier) else { return }
|
guard let smartFeed = SmartFeedsController.shared.find(by: feedIdentifier) else { return }
|
||||||
|
|
||||||
expand(SmartFeedsController.shared)
|
markExpanded(SmartFeedsController.shared)
|
||||||
rebuildBackingStores() {
|
rebuildBackingStores() {
|
||||||
self.treeControllerDelegate.resetFilterExceptions()
|
self.treeControllerDelegate.resetFilterExceptions()
|
||||||
if let indexPath = self.indexPathFor(smartFeed) {
|
if let indexPath = self.indexPathFor(smartFeed) {
|
||||||
|
@ -2031,7 +2027,7 @@ private extension SceneCoordinator {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
expand(account)
|
markExpanded(account)
|
||||||
|
|
||||||
rebuildBackingStores() {
|
rebuildBackingStores() {
|
||||||
self.treeControllerDelegate.resetFilterExceptions()
|
self.treeControllerDelegate.resetFilterExceptions()
|
||||||
|
|
Loading…
Reference in New Issue