mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
no message
This commit is contained in:
@@ -2,21 +2,25 @@ import Postbox
|
||||
|
||||
public struct CacheStorageSettings: PreferencesEntry, Equatable {
|
||||
public let defaultCacheStorageTimeout: Int32
|
||||
|
||||
public let defaultCacheStorageLimitGigabytes: Int32
|
||||
|
||||
public static var defaultSettings: CacheStorageSettings {
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: Int32.max)
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: Int32.max, defaultCacheStorageLimitGigabytes: Int32.max)
|
||||
}
|
||||
|
||||
public init(defaultCacheStorageTimeout: Int32) {
|
||||
public init(defaultCacheStorageTimeout: Int32, defaultCacheStorageLimitGigabytes: Int32) {
|
||||
self.defaultCacheStorageTimeout = defaultCacheStorageTimeout
|
||||
self.defaultCacheStorageLimitGigabytes = defaultCacheStorageLimitGigabytes
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.defaultCacheStorageTimeout = decoder.decodeInt32ForKey("dt", orElse: Int32.max)
|
||||
self.defaultCacheStorageLimitGigabytes = decoder.decodeInt32ForKey("dl", orElse: Int32.max)
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
encoder.encodeInt32(self.defaultCacheStorageTimeout, forKey: "dt")
|
||||
encoder.encodeInt32(self.defaultCacheStorageLimitGigabytes, forKey: "dl")
|
||||
}
|
||||
|
||||
public func isEqual(to: PreferencesEntry) -> Bool {
|
||||
@@ -28,10 +32,13 @@ public struct CacheStorageSettings: PreferencesEntry, Equatable {
|
||||
}
|
||||
|
||||
public static func ==(lhs: CacheStorageSettings, rhs: CacheStorageSettings) -> Bool {
|
||||
return lhs.defaultCacheStorageTimeout == rhs.defaultCacheStorageTimeout
|
||||
return lhs.defaultCacheStorageTimeout == rhs.defaultCacheStorageTimeout && lhs.defaultCacheStorageLimitGigabytes == rhs.defaultCacheStorageLimitGigabytes
|
||||
}
|
||||
|
||||
public func withUpdatedDefaultCacheStorageTimeout(_ defaultCacheStorageTimeout: Int32) -> CacheStorageSettings {
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: defaultCacheStorageTimeout)
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: defaultCacheStorageTimeout, defaultCacheStorageLimitGigabytes: self.defaultCacheStorageLimitGigabytes)
|
||||
}
|
||||
public func withUpdatedDefaultCacheStorageLimitGigabytes(_ defaultCacheStorageLimitGigabytes: Int32) -> CacheStorageSettings {
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: self.defaultCacheStorageTimeout, defaultCacheStorageLimitGigabytes: defaultCacheStorageLimitGigabytes)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user