Merge commit '2266e38d691b345f49ae3c2cf9cc669c808b31d6'

This commit is contained in:
Ali
2021-01-20 00:27:52 +04:00
42 changed files with 5746 additions and 4756 deletions

View File

@@ -3,20 +3,24 @@ import Postbox
public final class CachedStickerQueryResult: PostboxCoding {
public let items: [TelegramMediaFile]
public let hash: Int32
public let timestamp: Int32
public init(items: [TelegramMediaFile], hash: Int32) {
public init(items: [TelegramMediaFile], hash: Int32, timestamp: Int32) {
self.items = items
self.hash = hash
self.timestamp = timestamp
}
public init(decoder: PostboxDecoder) {
self.items = decoder.decodeObjectArrayForKey("it").map { $0 as! TelegramMediaFile }
self.hash = decoder.decodeInt32ForKey("h", orElse: 0)
self.timestamp = decoder.decodeInt32ForKey("t", orElse: 0)
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeObjectArray(self.items, forKey: "it")
encoder.encodeInt32(self.hash, forKey: "h")
encoder.encodeInt32(self.timestamp, forKey: "t")
}
public static func cacheKey(_ query: String) -> ValueBoxKey {

View File

@@ -66,4 +66,8 @@ public struct ExportedInvitation: PostboxCoding, Equatable {
public static func ==(lhs: ExportedInvitation, rhs: ExportedInvitation) -> Bool {
return lhs.link == rhs.link && lhs.isPermanent == rhs.isPermanent && lhs.isRevoked == rhs.isRevoked && lhs.adminId == rhs.adminId && lhs.date == rhs.date && lhs.startDate == rhs.startDate && lhs.expireDate == rhs.expireDate && lhs.usageLimit == rhs.usageLimit && lhs.count == rhs.count
}
public func withUpdated(isRevoked: Bool) -> ExportedInvitation {
return ExportedInvitation(link: self.link, isPermanent: self.isPermanent, isRevoked: isRevoked, adminId: self.adminId, date: self.date, startDate: self.startDate, expireDate: self.expireDate, usageLimit: self.usageLimit, count: self.count)
}
}

View File

@@ -74,6 +74,7 @@ public struct Namespaces {
public static let cachedContextResults: Int8 = 10
public static let proximityNotificationStoredState: Int8 = 11
public static let cachedPeerInvitationImporters: Int8 = 12
public static let cachedPeerExportedInvitations: Int8 = 13
}
public struct UnorderedItemList {