From 78701f1b737fd0b11dc4a2cccb33d078f317f94c Mon Sep 17 00:00:00 2001 From: J Logan Date: Tue, 14 Oct 2025 17:00:03 -0700 Subject: [PATCH] Add app bundle Info.plist as a system property source. (#764) - Closes #708. - Allows `container` and services/plugins to get backstop defaults from `Info.plist` properties if repackaged into a signed app bundle. --- Sources/ContainerPersistence/DefaultsStore.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sources/ContainerPersistence/DefaultsStore.swift b/Sources/ContainerPersistence/DefaultsStore.swift index ce74fa3b..3754cdcd 100644 --- a/Sources/ContainerPersistence/DefaultsStore.swift +++ b/Sources/ContainerPersistence/DefaultsStore.swift @@ -41,8 +41,9 @@ public enum DefaultsStore { } public static func get(key: DefaultsStore.Keys) -> String { - let current = udSuite.string(forKey: key.rawValue) - return current ?? key.defaultValue + udSuite.string(forKey: key.rawValue) + ?? Bundle.main.infoDictionary?["\(Self.userDefaultDomain).\(key.rawValue)"] as? String + ?? key.defaultValue } public static func getOptional(key: DefaultsStore.Keys) -> String? { @@ -54,8 +55,11 @@ public enum DefaultsStore { } public static func getBool(key: DefaultsStore.Keys) -> Bool? { - guard udSuite.object(forKey: key.rawValue) != nil else { return nil } - return udSuite.bool(forKey: key.rawValue) + if udSuite.object(forKey: key.rawValue) != nil { + return udSuite.bool(forKey: key.rawValue) + } + return Bundle.main.infoDictionary?["\(Self.userDefaultDomain).\(key.rawValue)"] as? Bool + ?? Bool(key.defaultValue) } public static func allValues() -> [DefaultsStoreValue] {