Make sure top level nodes are always expanded.

This commit is contained in:
Maurice Parker 2019-11-21 16:25:00 -06:00
parent 89e9a7b80e
commit 64c1a615b0
2 changed files with 6 additions and 33 deletions

View File

@ -40,6 +40,7 @@ private extension WebFeedTreeControllerDelegate {
let smartFeedsNode = rootNode.existingOrNewChildNode(with: SmartFeedsController.shared)
smartFeedsNode.canHaveChildNodes = true
smartFeedsNode.isGroupItem = true
smartFeedsNode.isExpanded = true
topLevelNodes.append(smartFeedsNode)
}
@ -136,6 +137,7 @@ private extension WebFeedTreeControllerDelegate {
let accountNode = parent.existingOrNewChildNode(with: account)
accountNode.canHaveChildNodes = true
accountNode.isGroupItem = true
accountNode.isExpanded = true
return accountNode
}
return nodes

View File

@ -268,7 +268,6 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
super.init()
for section in treeController.rootNode.childNodes {
section.isExpanded = true
shadowTable.append([Node]())
}
@ -392,51 +391,23 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
}
@objc func accountStateDidChange(_ note: Notification) {
let rebuildAndExpand = {
guard let account = note.userInfo?[Account.UserInfoKey.account] as? Account else {
assertionFailure()
return
}
self.rebuildBackingStores() {
// If we are activating an account, then automatically expand it
if account.isActive, let node = self.treeController.rootNode.childNodeRepresentingObject(account) {
node.isExpanded = true
}
}
}
if timelineFetcherContainsAnyPseudoFeed() {
fetchAndReplaceArticlesAsync {
rebuildAndExpand()
self.rebuildBackingStores()
}
} else {
rebuildAndExpand()
rebuildBackingStores()
}
}
@objc func userDidAddAccount(_ note: Notification) {
let rebuildAndExpand = {
self.rebuildBackingStores() {
// Automatically expand any new accounts
if let account = note.userInfo?[Account.UserInfoKey.account] as? Account,
let node = self.treeController.rootNode.childNodeRepresentingObject(account) {
node.isExpanded = true
}
}
}
if timelineFetcherContainsAnyPseudoFeed() {
fetchAndReplaceArticlesAsync {
rebuildAndExpand()
self.rebuildBackingStores()
}
} else {
rebuildAndExpand()
rebuildBackingStores()
}
}
@objc func userDidDeleteAccount(_ note: Notification) {