mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.6 KiB
Swift
60 lines
1.6 KiB
Swift
import Foundation
|
|
|
|
public enum SNUserDefaults {
|
|
|
|
public enum Bool : Swift.String {
|
|
case hasSyncedInitialConfiguration = "hasSyncedConfiguration"
|
|
case hasViewedSeed
|
|
case hasSeenLinkPreviewSuggestion
|
|
case isUsingFullAPNs
|
|
}
|
|
|
|
public enum Date : Swift.String {
|
|
case lastConfigurationSync
|
|
case lastDisplayNameUpdate
|
|
case lastProfilePictureUpdate
|
|
case lastOpenGroupImageUpdate
|
|
}
|
|
|
|
public enum Double : Swift.String {
|
|
case lastDeviceTokenUpload = "lastDeviceTokenUploadTime"
|
|
case lastOpenDate
|
|
}
|
|
|
|
public enum Int : Swift.String {
|
|
case appMode
|
|
}
|
|
|
|
public enum String : Swift.String {
|
|
case deviceToken
|
|
}
|
|
}
|
|
|
|
public extension UserDefaults {
|
|
|
|
subscript(bool: SNUserDefaults.Bool) -> Bool {
|
|
get { return self.bool(forKey: bool.rawValue) }
|
|
set { set(newValue, forKey: bool.rawValue) }
|
|
}
|
|
|
|
subscript(date: SNUserDefaults.Date) -> Date? {
|
|
get { return self.object(forKey: date.rawValue) as? Date }
|
|
set { set(newValue, forKey: date.rawValue) }
|
|
}
|
|
|
|
subscript(double: SNUserDefaults.Double) -> Double {
|
|
get { return self.double(forKey: double.rawValue) }
|
|
set { set(newValue, forKey: double.rawValue) }
|
|
}
|
|
|
|
subscript(int: SNUserDefaults.Int) -> Int {
|
|
get { return self.integer(forKey: int.rawValue) }
|
|
set { set(newValue, forKey: int.rawValue) }
|
|
}
|
|
|
|
subscript(string: SNUserDefaults.String) -> String? {
|
|
get { return self.string(forKey: string.rawValue) }
|
|
set { set(newValue, forKey: string.rawValue) }
|
|
}
|
|
}
|