Update API [skip ci]

This commit is contained in:
Ilya Laktyushin
2020-04-16 22:25:36 +04:00
parent eed8cb0b3f
commit 0f1211e427
7 changed files with 33 additions and 21 deletions

View File

@@ -1,20 +1,24 @@
import Postbox
public final class TelegramMediaDice: Media {
public let emoji: String
public let value: Int32?
public let id: MediaId? = nil
public let peerIds: [PeerId] = []
public init(value: Int32? = nil) {
public init(emoji: String, value: Int32? = nil) {
self.emoji = emoji
self.value = value
}
public init(decoder: PostboxDecoder) {
self.emoji = decoder.decodeStringForKey("e", orElse: "🎲")
self.value = decoder.decodeOptionalInt32ForKey("v")
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeString(self.emoji, forKey: "e")
if let value = self.value {
encoder.encodeInt32(value, forKey: "v")
} else {
@@ -24,6 +28,9 @@ public final class TelegramMediaDice: Media {
public func isEqual(to other: Media) -> Bool {
if let other = other as? TelegramMediaDice {
if self.emoji != other.emoji {
return false
}
if self.value != other.value {
return false
}