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

@@ -60,6 +60,21 @@ final class ContactTable: Table {
self.peerIds = nil
}
func transactionUpdatedPeers() -> [PeerId: (Bool, Bool)] {
var result: [PeerId: (Bool, Bool)] = [:]
if let peerIdsBeforeModification = self.peerIdsBeforeModification {
if let peerIds = self.peerIds {
let removedPeerIds = peerIdsBeforeModification.subtracting(peerIds)
let addedPeerIds = peerIds.subtracting(peerIdsBeforeModification)
for peerId in removedPeerIds.union(addedPeerIds) {
result[peerId] = (removedPeerIds.contains(peerId), addedPeerIds.contains(peerId))
}
}
}
return result
}
override func beforeCommit() {
if let peerIdsBeforeModification = self.peerIdsBeforeModification {
if let peerIds = self.peerIds {