Update filters

This commit is contained in:
Ali
2020-03-04 02:10:49 +04:00
parent d14e0772e7
commit 4397baa226
87 changed files with 3840 additions and 1931 deletions

View File

@@ -4,11 +4,13 @@ final class MutableBasicPeerView: MutablePostboxView {
private let peerId: PeerId
fileprivate var peer: Peer?
fileprivate var notificationSettings: PeerNotificationSettings?
fileprivate var isContact: Bool
init(postbox: Postbox, peerId: PeerId) {
self.peerId = peerId
self.peer = postbox.peerTable.get(peerId)
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
self.isContact = postbox.contactsTable.isContact(peerId: self.peerId)
}
func replay(postbox: Postbox, transaction: PostboxTransaction) -> Bool {
@@ -21,6 +23,13 @@ final class MutableBasicPeerView: MutablePostboxView {
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
updated = true
}
if transaction.replaceContactPeerIds != nil {
let isContact = postbox.contactsTable.isContact(peerId: self.peerId)
if isContact != self.isContact {
self.isContact = isContact
updated = true
}
}
return updated
}
@@ -33,9 +42,11 @@ final class MutableBasicPeerView: MutablePostboxView {
public final class BasicPeerView: PostboxView {
public let peer: Peer?
public let notificationSettings: PeerNotificationSettings?
public let isContact: Bool
init(_ view: MutableBasicPeerView) {
self.peer = view.peer
self.notificationSettings = view.notificationSettings
self.isContact = view.isContact
}
}