Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Sources/ContainerPersistence/DefaultsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand All @@ -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] {
Expand Down