mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Fix decoding
This commit is contained in:
parent
b10556fdd0
commit
1fced74098
@ -666,19 +666,8 @@ public final class BotApp: Equatable, Codable {
|
|||||||
self.shortName = try container.decode(String.self, forKey: .shortName)
|
self.shortName = try container.decode(String.self, forKey: .shortName)
|
||||||
self.title = try container.decode(String.self, forKey: .title)
|
self.title = try container.decode(String.self, forKey: .title)
|
||||||
self.description = try container.decode(String.self, forKey: .description)
|
self.description = try container.decode(String.self, forKey: .description)
|
||||||
|
self.photo = try container.decodeIfPresent(TelegramMediaImage.self, forKey: .photo)
|
||||||
if let data = try container.decodeIfPresent(AdaptedPostboxDecoder.RawObjectData.self, forKey: .photo) {
|
self.document = try container.decodeIfPresent(TelegramMediaFile.self, forKey: .document)
|
||||||
self.photo = TelegramMediaImage(decoder: PostboxDecoder(buffer: MemoryBuffer(data: data.data)))
|
|
||||||
} else {
|
|
||||||
self.photo = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if let data = try container.decodeIfPresent(AdaptedPostboxDecoder.RawObjectData.self, forKey: .document) {
|
|
||||||
self.document = TelegramMediaFile(decoder: PostboxDecoder(buffer: MemoryBuffer(data: data.data)))
|
|
||||||
} else {
|
|
||||||
self.document = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
self.hash = try container.decode(Int64.self, forKey: .hash)
|
self.hash = try container.decode(Int64.self, forKey: .hash)
|
||||||
self.flags = Flags(rawValue: try container.decode(Int32.self, forKey: .flags))
|
self.flags = Flags(rawValue: try container.decode(Int32.self, forKey: .flags))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user