mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
fix decoding
This commit is contained in:
@@ -17,6 +17,7 @@ public final class AvailableReactions: Equatable, Codable {
|
|||||||
case effectAnimation
|
case effectAnimation
|
||||||
case aroundAnimation
|
case aroundAnimation
|
||||||
case centerAnimation
|
case centerAnimation
|
||||||
|
case isStars
|
||||||
}
|
}
|
||||||
|
|
||||||
public let isEnabled: Bool
|
public let isEnabled: Bool
|
||||||
@@ -100,7 +101,12 @@ public final class AvailableReactions: Equatable, Codable {
|
|||||||
self.isEnabled = try container.decode(Bool.self, forKey: .isEnabled)
|
self.isEnabled = try container.decode(Bool.self, forKey: .isEnabled)
|
||||||
self.isPremium = try container.decodeIfPresent(Bool.self, forKey: .isPremium) ?? false
|
self.isPremium = try container.decodeIfPresent(Bool.self, forKey: .isPremium) ?? false
|
||||||
|
|
||||||
|
let isStars = try container.decodeIfPresent(Bool.self, forKey: .isStars) ?? false
|
||||||
|
if isStars {
|
||||||
|
self.value = .stars
|
||||||
|
} else {
|
||||||
self.value = .builtin(try container.decode(String.self, forKey: .value))
|
self.value = .builtin(try container.decode(String.self, forKey: .value))
|
||||||
|
}
|
||||||
self.title = try container.decode(String.self, forKey: .title)
|
self.title = try container.decode(String.self, forKey: .title)
|
||||||
|
|
||||||
let staticIconData = try container.decode(AdaptedPostboxDecoder.RawObjectData.self, forKey: .staticIcon)
|
let staticIconData = try container.decode(AdaptedPostboxDecoder.RawObjectData.self, forKey: .staticIcon)
|
||||||
@@ -143,7 +149,7 @@ public final class AvailableReactions: Equatable, Codable {
|
|||||||
case .custom:
|
case .custom:
|
||||||
break
|
break
|
||||||
case .stars:
|
case .stars:
|
||||||
break
|
try container.encode(true, forKey: .isStars)
|
||||||
}
|
}
|
||||||
try container.encode(self.title, forKey: .title)
|
try container.encode(self.title, forKey: .title)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user