mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Make sure the first build of the backing stores isn't filtered so that state restoration has something to work with.
This commit is contained in:
parent
e9032c4a0f
commit
708c7de7fa
@ -330,9 +330,33 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
||||
|
||||
func restoreWindowState(_ activity: NSUserActivity?) {
|
||||
if let activity = activity, let windowState = activity.userInfo?[UserInfoKey.windowState] as? [AnyHashable: Any] {
|
||||
restoreWindowState(windowState)
|
||||
|
||||
if let containerExpandedWindowState = windowState[UserInfoKey.containerExpandedWindowState] as? [[AnyHashable: AnyHashable]] {
|
||||
let containerIdentifers = containerExpandedWindowState.compactMap( { ContainerIdentifier(userInfo: $0) })
|
||||
expandedTable = Set(containerIdentifers)
|
||||
}
|
||||
|
||||
if let readArticlesFilterState = windowState[UserInfoKey.readArticlesFilterState] as? [[AnyHashable: AnyHashable]: Bool] {
|
||||
for key in readArticlesFilterState.keys {
|
||||
if let feedIdentifier = FeedIdentifier(userInfo: key) {
|
||||
readFilterEnabledTable[feedIdentifier] = readArticlesFilterState[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rebuildBackingStores(initialLoad: true)
|
||||
|
||||
// You can't assign the Feeds Read Filter until we've built the backing stores at least once or there is nothing
|
||||
// for state restoration to work with while we are waiting for the unread counts to initialize.
|
||||
if let readFeedsFilterState = windowState[UserInfoKey.readFeedsFilterState] as? Bool {
|
||||
treeControllerDelegate.isReadFiltered = readFeedsFilterState
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
rebuildBackingStores(initialLoad: true)
|
||||
|
||||
}
|
||||
rebuildBackingStores(initialLoad: true)
|
||||
}
|
||||
|
||||
func handle(_ activity: NSUserActivity) {
|
||||
@ -1788,23 +1812,6 @@ private extension SceneCoordinator {
|
||||
]
|
||||
}
|
||||
|
||||
func restoreWindowState(_ windowState: [AnyHashable: Any]) {
|
||||
if let readFeedsFilterState = windowState[UserInfoKey.readFeedsFilterState] as? Bool {
|
||||
treeControllerDelegate.isReadFiltered = readFeedsFilterState
|
||||
}
|
||||
if let containerExpandedWindowState = windowState[UserInfoKey.containerExpandedWindowState] as? [[AnyHashable: AnyHashable]] {
|
||||
let containerIdentifers = containerExpandedWindowState.compactMap( { ContainerIdentifier(userInfo: $0) })
|
||||
expandedTable = Set(containerIdentifers)
|
||||
}
|
||||
if let readArticlesFilterState = windowState[UserInfoKey.readArticlesFilterState] as? [[AnyHashable: AnyHashable]: Bool] {
|
||||
for key in readArticlesFilterState.keys {
|
||||
if let feedIdentifier = FeedIdentifier(userInfo: key) {
|
||||
readFilterEnabledTable[feedIdentifier] = readArticlesFilterState[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleSelectFeed(_ userInfo: [AnyHashable : Any]?) {
|
||||
guard let userInfo = userInfo,
|
||||
let feedIdentifierUserInfo = userInfo[UserInfoKey.feedIdentifier] as? [AnyHashable : AnyHashable],
|
||||
|
Loading…
Reference in New Issue
Block a user