mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Update API
This commit is contained in:
@@ -5,7 +5,7 @@ public struct CacheStorageSettings: Codable, Equatable {
|
||||
public let defaultCacheStorageLimitGigabytes: Int32
|
||||
|
||||
public static var defaultSettings: CacheStorageSettings {
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: Int32.max, defaultCacheStorageLimitGigabytes: Int32.max)
|
||||
return CacheStorageSettings(defaultCacheStorageTimeout: Int32.max, defaultCacheStorageLimitGigabytes: 8 * 1024 * 1024)
|
||||
}
|
||||
|
||||
public init(defaultCacheStorageTimeout: Int32, defaultCacheStorageLimitGigabytes: Int32) {
|
||||
@@ -17,7 +17,14 @@ public struct CacheStorageSettings: Codable, Equatable {
|
||||
let container = try decoder.container(keyedBy: StringCodingKey.self)
|
||||
|
||||
self.defaultCacheStorageTimeout = (try? container.decode(Int32.self, forKey: "dt")) ?? Int32.max
|
||||
self.defaultCacheStorageLimitGigabytes = (try? container.decode(Int32.self, forKey: "dl")) ?? Int32.max
|
||||
|
||||
if let legacyValue = try container.decodeIfPresent(Int32.self, forKey: "dl") {
|
||||
self.defaultCacheStorageLimitGigabytes = legacyValue
|
||||
} else if let value = try container.decodeIfPresent(Int32.self, forKey: "sizeLimit") {
|
||||
self.defaultCacheStorageLimitGigabytes = value
|
||||
} else {
|
||||
self.defaultCacheStorageLimitGigabytes = 8 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
|
||||
public final class CachedPeerBotInfo: PostboxCoding, Equatable {
|
||||
public let peerId: PeerId
|
||||
@@ -82,6 +83,19 @@ public enum PeerAllowedReactions: Equatable, Codable {
|
||||
}
|
||||
}
|
||||
|
||||
extension PeerAllowedReactions {
|
||||
init(apiReactions: Api.ChatReactions) {
|
||||
switch apiReactions {
|
||||
case .chatReactionsAll:
|
||||
self = .all
|
||||
case let .chatReactionsSome(reactions):
|
||||
self = .limited(reactions.compactMap(MessageReaction.Reaction.init(apiReaction:)))
|
||||
case .chatReactionsNone:
|
||||
self = .empty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class CachedGroupData: CachedPeerData {
|
||||
public let participants: CachedGroupParticipants?
|
||||
public let exportedInvitation: ExportedInvitation?
|
||||
|
||||
Reference in New Issue
Block a user