mirror of
https://github.com/apple/container.git
synced 2026-08-28 11:26:32 +00:00
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.
This commit is contained in:
@@ -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] {
|
||||
|
||||
Reference in New Issue
Block a user