Expand new or newly active accounts so that they don't look broken
This commit is contained in:
parent
141ec961e9
commit
eb89ee7128
@ -345,9 +345,21 @@ protocol SidebarDelegate: class {
|
|||||||
// MARK: - API
|
// MARK: - API
|
||||||
|
|
||||||
func rebuildTreeAndRestoreSelection() {
|
func rebuildTreeAndRestoreSelection() {
|
||||||
|
|
||||||
|
let savedAccounts = treeController.rootNode.childNodes.compactMap { $0.representedObject as? Account }
|
||||||
|
|
||||||
let savedSelection = selectedNodes
|
let savedSelection = selectedNodes
|
||||||
rebuildTreeAndReloadDataIfNeeded()
|
rebuildTreeAndReloadDataIfNeeded()
|
||||||
restoreSelection(to: savedSelection, sendNotificationIfChanged: true)
|
restoreSelection(to: savedSelection, sendNotificationIfChanged: true)
|
||||||
|
|
||||||
|
// Automatically expand any new or newly active accounts
|
||||||
|
AccountManager.shared.activeAccounts.forEach { account in
|
||||||
|
if !savedAccounts.contains(account) {
|
||||||
|
let accountNode = treeController.nodeInTreeRepresentingObject(account)
|
||||||
|
outlineView.expandItem(accountNode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user