Thread draft synchronization

This commit is contained in:
Ali
2022-10-16 17:06:30 +04:00
parent 8b84be981f
commit 7d62cee9f5
4 changed files with 61 additions and 16 deletions

View File

@@ -2,13 +2,16 @@ import Postbox
public final class SynchronizeChatInputStateOperation: PostboxCoding {
public let previousState: SynchronizeableChatInputState?
public let threadId: Int64?
public init(previousState: SynchronizeableChatInputState?) {
public init(previousState: SynchronizeableChatInputState?, threadId: Int64?) {
self.previousState = previousState
self.threadId = threadId
}
public init(decoder: PostboxDecoder) {
self.previousState = decoder.decode(SynchronizeableChatInputState.self, forKey: "p")
self.threadId = decoder.decodeOptionalInt64ForKey("threadId")
}
public func encode(_ encoder: PostboxEncoder) {
@@ -17,5 +20,10 @@ public final class SynchronizeChatInputStateOperation: PostboxCoding {
} else {
encoder.encodeNil(forKey: "p")
}
if let threadId = self.threadId {
encoder.encodeInt64(threadId, forKey: "threadId")
} else {
encoder.encodeNil(forKey: "threadId")
}
}
}