Experimental chat list filtering

This commit is contained in:
Ali
2020-01-24 13:01:49 +04:00
parent 13b0847b1e
commit d2e3c9d54a
18 changed files with 880 additions and 87 deletions

View File

@@ -225,7 +225,7 @@ final class PeerNotificationSettingsTable: Table {
return (added, removed)
}
func resetAll(to settings: PeerNotificationSettings, updatedSettings: inout Set<PeerId>, updatedTimestamps: inout [PeerId: PeerNotificationSettingsBehaviorTimestamp]) -> [PeerId] {
func resetAll(to settings: PeerNotificationSettings, updatedSettings: inout Set<PeerId>, updatedTimestamps: inout [PeerId: PeerNotificationSettingsBehaviorTimestamp]) -> [PeerId: PeerNotificationSettings?] {
let lowerBound = ValueBoxKey(length: 8)
lowerBound.setInt64(0, value: 0)
let upperBound = ValueBoxKey(length: 8)
@@ -236,17 +236,17 @@ final class PeerNotificationSettingsTable: Table {
return true
}, limit: 0)
var updatedPeerIds: [PeerId] = []
var updatedPeers: [PeerId: PeerNotificationSettings?] = [:]
for peerId in peerIds {
let entry = self.getEntry(peerId)
if let current = entry.current, !current.isEqual(to: settings) || entry.pending != nil {
let _ = self.setCurrent(id: peerId, settings: settings, updatedTimestamps: &updatedTimestamps)
let _ = self.setPending(id: peerId, settings: nil, updatedSettings: &updatedSettings)
updatedPeerIds.append(peerId)
updatedPeers[peerId] = entry.effective
}
}
return updatedPeerIds
return updatedPeers
}
override func beforeCommit() {