mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Refactoring
This commit is contained in:
@@ -35,6 +35,14 @@ extension _AdaptedPostboxDecoder.KeyedContainer: KeyedDecodingContainerProtocol
|
||||
|
||||
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T : Decodable {
|
||||
if let (data, valueType) = self.decoder.decodeObjectDataForKey(key.stringValue) {
|
||||
if type == AdaptedPostboxDecoder.RawObjectData.self {
|
||||
if case let .Object(typeHash) = valueType {
|
||||
return AdaptedPostboxDecoder.RawObjectData(data: data, typeHash: typeHash) as! T
|
||||
} else {
|
||||
decodingErrorBreakpoint()
|
||||
throw DecodingError.typeMismatch(T.self, DecodingError.Context(codingPath: self.codingPath + [key], debugDescription: ""))
|
||||
}
|
||||
}
|
||||
if let mappedType = AdaptedPostboxDecoder.ContentType(valueType: valueType) {
|
||||
return try AdaptedPostboxDecoder().decode(T.self, from: data, contentType: mappedType)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user