Refactor SyncCore

This commit is contained in:
Peter
2019-10-21 16:58:00 +04:00
parent 75aa77faa8
commit 10692a323e
1162 changed files with 12205 additions and 10925 deletions

View File

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