mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Updated comments
This commit is contained in:
@@ -4,23 +4,31 @@ import Postbox
|
||||
public class ReplyThreadMessageAttribute: MessageAttribute {
|
||||
public let count: Int32
|
||||
public let latestUsers: [PeerId]
|
||||
public let commentsPeerId: PeerId?
|
||||
|
||||
public var associatedPeerIds: [PeerId] {
|
||||
return self.latestUsers
|
||||
}
|
||||
|
||||
public init(count: Int32, latestUsers: [PeerId]) {
|
||||
public init(count: Int32, latestUsers: [PeerId], commentsPeerId: PeerId?) {
|
||||
self.count = count
|
||||
self.latestUsers = latestUsers
|
||||
self.commentsPeerId = commentsPeerId
|
||||
}
|
||||
|
||||
required public init(decoder: PostboxDecoder) {
|
||||
self.count = decoder.decodeInt32ForKey("c", orElse: 0)
|
||||
self.latestUsers = decoder.decodeInt64ArrayForKey("u").map(PeerId.init)
|
||||
self.commentsPeerId = decoder.decodeOptionalInt64ForKey("cp").flatMap(PeerId.init)
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
encoder.encodeInt32(self.count, forKey: "c")
|
||||
encoder.encodeInt64Array(self.latestUsers.map { $0.toInt64() }, forKey: "u")
|
||||
if let commentsPeerId = self.commentsPeerId {
|
||||
encoder.encodeInt64(commentsPeerId.toInt64(), forKey: "cp")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "cp")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user