mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Residual coding
This commit is contained in:
@@ -49,17 +49,19 @@ public final class StickerPackCollectionInfo: ItemCollectionInfo, Equatable {
|
||||
public let title: String
|
||||
public let shortName: String
|
||||
public let thumbnail: TelegramMediaImageRepresentation?
|
||||
public let thumbnailFileId: Int64?
|
||||
public let immediateThumbnailData: Data?
|
||||
public let hash: Int32
|
||||
public let count: Int32
|
||||
|
||||
public init(id: ItemCollectionId, flags: StickerPackCollectionInfoFlags, accessHash: Int64, title: String, shortName: String, thumbnail: TelegramMediaImageRepresentation?, immediateThumbnailData: Data?, hash: Int32, count: Int32) {
|
||||
public init(id: ItemCollectionId, flags: StickerPackCollectionInfoFlags, accessHash: Int64, title: String, shortName: String, thumbnail: TelegramMediaImageRepresentation?, thumbnailFileId: Int64?, immediateThumbnailData: Data?, hash: Int32, count: Int32) {
|
||||
self.id = id
|
||||
self.flags = flags
|
||||
self.accessHash = accessHash
|
||||
self.title = title
|
||||
self.shortName = shortName
|
||||
self.thumbnail = thumbnail
|
||||
self.thumbnailFileId = thumbnailFileId
|
||||
self.immediateThumbnailData = immediateThumbnailData
|
||||
self.hash = hash
|
||||
self.count = count
|
||||
@@ -71,6 +73,7 @@ public final class StickerPackCollectionInfo: ItemCollectionInfo, Equatable {
|
||||
self.title = decoder.decodeStringForKey("t", orElse: "")
|
||||
self.shortName = decoder.decodeStringForKey("s", orElse: "")
|
||||
self.thumbnail = decoder.decodeObjectForKey("th", decoder: { TelegramMediaImageRepresentation(decoder: $0) }) as? TelegramMediaImageRepresentation
|
||||
self.thumbnailFileId = decoder.decodeOptionalInt64ForKey("tfi")
|
||||
self.immediateThumbnailData = decoder.decodeDataForKey("itd")
|
||||
self.hash = decoder.decodeInt32ForKey("h", orElse: 0)
|
||||
self.flags = StickerPackCollectionInfoFlags(rawValue: decoder.decodeInt32ForKey("f", orElse: 0))
|
||||
@@ -88,6 +91,11 @@ public final class StickerPackCollectionInfo: ItemCollectionInfo, Equatable {
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "th")
|
||||
}
|
||||
if let thumbnailFileId = self.thumbnailFileId {
|
||||
encoder.encodeInt64(thumbnailFileId, forKey: "tfi")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "tfi")
|
||||
}
|
||||
if let immediateThumbnailData = self.immediateThumbnailData {
|
||||
encoder.encodeData(immediateThumbnailData, forKey: "itd")
|
||||
} else {
|
||||
@@ -119,6 +127,10 @@ public final class StickerPackCollectionInfo: ItemCollectionInfo, Equatable {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhs.thumbnailFileId != rhs.thumbnailFileId {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhs.flags != rhs.flags {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user