Rename containerExpandedWindowState to expandedContainers.

This commit is contained in:
Brent Simmons committed 2025-12-01 14:55:01 -08:00
1 parent ea6eedb864
commit f6bca9ee8f
2 files changed
+9 -9

No files matched your search

+5 -5
View File
@@ -66,7 +66,7 @@ final class AppDefaults {
static let hideReadFeeds = "hideReadFeeds"
static let isShowingExtractedArticle = "isShowingExtractedArticle"
static let articleWindowScrollY = "articleWindowScrollY"
static let containerExpandedWindowState = "containerExpandedWindowState"
static let expandedContainers = "expandedContainers"
static let readArticlesFilterState = "readArticlesFilterState"
static let selectedFeedIdentifier = "selectedFeedIdentifier"
}
@@ -287,9 +287,9 @@ final class AppDefaults {
}
}
var containerExpandedWindowState: Set<ContainerIdentifier>? {
var expandedContainers: Set<ContainerIdentifier>? {
get {
guard let rawIdentifiers = UserDefaults.standard.array(forKey: Key.containerExpandedWindowState) as? [[String: String]] else {
guard let rawIdentifiers = UserDefaults.standard.array(forKey: Key.expandedContainers) as? [[String: String]] else {
return nil
}
let containerIdentifiers = rawIdentifiers.compactMap { ContainerIdentifier(userInfo: $0) }
@@ -297,11 +297,11 @@ final class AppDefaults {
}
set {
guard let newValue, !newValue.isEmpty else {
UserDefaults.standard.set([String: String](), forKey: Key.containerExpandedWindowState)
UserDefaults.standard.set([String: String](), forKey: Key.expandedContainers)
return
}
let containerIdentifierUserInfos = newValue.compactMap { $0.userInfo }
UserDefaults.standard.set(containerIdentifierUserInfos, forKey: Key.containerExpandedWindowState)
UserDefaults.standard.set(containerIdentifierUserInfos, forKey: Key.expandedContainers)
}
}
+4 -4
View File
@@ -325,7 +325,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner {
}
// containerExpandedWindowState
if AppDefaults.shared.containerExpandedWindowState == nil,
if AppDefaults.shared.expandedContainers == nil,
let legacyState = windowState[UserInfoKey.containerExpandedWindowState] as? [[AnyHashable: AnyHashable]] {
let convertedState = legacyState.compactMap { dict -> [String: String]? in
var stringDict = [String: String]()
@@ -337,7 +337,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner {
return stringDict.isEmpty ? nil : stringDict
}
let containerIdentifiers = convertedState.compactMap { ContainerIdentifier(userInfo: $0) }
AppDefaults.shared.containerExpandedWindowState = Set(containerIdentifiers)
AppDefaults.shared.expandedContainers = Set(containerIdentifiers)
}
// readArticlesFilterState
@@ -378,7 +378,7 @@ final class SceneCoordinator: NSObject, UndoableCommandRunner {
private func restoreWindowStateFromUserDefaults() {
// Restore containerExpandedWindowState from UserDefaults
if let storedState = AppDefaults.shared.containerExpandedWindowState {
if let storedState = AppDefaults.shared.expandedContainers {
expandedTable.formUnion(storedState)
}
@@ -1734,7 +1734,7 @@ private extension SceneCoordinator {
}
private func saveExpandedTableToUserDefaults() {
AppDefaults.shared.containerExpandedWindowState = expandedTable
AppDefaults.shared.expandedContainers = expandedTable
}
private func saveReadFilterEnabledTableToUserDefaults() {