Support refreshDueToExternalTransaction in more views

This commit is contained in:
Ali
2021-11-04 21:09:34 +04:00
parent 9290df840d
commit ddb0999af0
36 changed files with 407 additions and 15 deletions

View File

@@ -2,7 +2,7 @@ import Foundation
final class MutablePeerChatStateView: MutablePostboxView {
let peerId: PeerId
var chatState: PostboxCoding?
var chatState: CodableEntry?
init(postbox: PostboxImpl, peerId: PeerId) {
self.peerId = peerId
@@ -17,6 +17,16 @@ final class MutablePeerChatStateView: MutablePostboxView {
return false
}
}
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
let chatState = postbox.peerChatStateTable.get(self.peerId)
if self.chatState != chatState {
self.chatState = chatState
return true
} else {
return false
}
}
func immutableView() -> PostboxView {
return PeerChatStateView(self)
@@ -25,7 +35,7 @@ final class MutablePeerChatStateView: MutablePostboxView {
public final class PeerChatStateView: PostboxView {
public let peerId: PeerId
public let chatState: PostboxCoding?
public let chatState: CodableEntry?
init(_ view: MutablePeerChatStateView) {
self.peerId = view.peerId