mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Shared media improvements
This commit is contained in:
@@ -112,17 +112,23 @@ public extension CloudChatClearHistoryType {
|
||||
public final class CloudChatClearHistoryOperation: PostboxCoding {
|
||||
public let peerId: PeerId
|
||||
public let topMessageId: MessageId
|
||||
public let minTimestamp: Int32?
|
||||
public let maxTimestamp: Int32?
|
||||
public let type: CloudChatClearHistoryType
|
||||
|
||||
public init(peerId: PeerId, topMessageId: MessageId, type: CloudChatClearHistoryType) {
|
||||
public init(peerId: PeerId, topMessageId: MessageId, minTimestamp: Int32?, maxTimestamp: Int32?, type: CloudChatClearHistoryType) {
|
||||
self.peerId = peerId
|
||||
self.topMessageId = topMessageId
|
||||
self.minTimestamp = minTimestamp
|
||||
self.maxTimestamp = maxTimestamp
|
||||
self.type = type
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.peerId = PeerId(decoder.decodeInt64ForKey("p", orElse: 0))
|
||||
self.topMessageId = MessageId(peerId: PeerId(decoder.decodeInt64ForKey("m.p", orElse: 0)), namespace: decoder.decodeInt32ForKey("m.n", orElse: 0), id: decoder.decodeInt32ForKey("m.i", orElse: 0))
|
||||
self.minTimestamp = decoder.decodeOptionalInt32ForKey("minTimestamp")
|
||||
self.maxTimestamp = decoder.decodeOptionalInt32ForKey("maxTimestamp")
|
||||
self.type = CloudChatClearHistoryType(rawValue: decoder.decodeInt32ForKey("type", orElse: 0)) ?? .forLocalPeer
|
||||
}
|
||||
|
||||
@@ -131,6 +137,16 @@ public final class CloudChatClearHistoryOperation: PostboxCoding {
|
||||
encoder.encodeInt64(self.topMessageId.peerId.toInt64(), forKey: "m.p")
|
||||
encoder.encodeInt32(self.topMessageId.namespace, forKey: "m.n")
|
||||
encoder.encodeInt32(self.topMessageId.id, forKey: "m.i")
|
||||
if let minTimestamp = self.minTimestamp {
|
||||
encoder.encodeInt32(minTimestamp, forKey: "minTimestamp")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "minTimestamp")
|
||||
}
|
||||
if let maxTimestamp = self.maxTimestamp {
|
||||
encoder.encodeInt32(maxTimestamp, forKey: "maxTimestamp")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "maxTimestamp")
|
||||
}
|
||||
encoder.encodeInt32(self.type.rawValue, forKey: "type")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user