mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix contact ids scan
This commit is contained in:
parent
bcdf3db63b
commit
b90e1bcef6
@ -21,14 +21,6 @@ final class ContactTable: Table {
|
|||||||
return sharedKey
|
return sharedKey
|
||||||
}
|
}
|
||||||
|
|
||||||
private func lowerBound() -> ValueBoxKey {
|
|
||||||
return self.key(PeerId(0))
|
|
||||||
}
|
|
||||||
|
|
||||||
private func upperBound() -> ValueBoxKey {
|
|
||||||
return self.key(PeerId.max)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isContact(peerId: PeerId) -> Bool {
|
func isContact(peerId: PeerId) -> Bool {
|
||||||
return self.get().contains(peerId)
|
return self.get().contains(peerId)
|
||||||
}
|
}
|
||||||
@ -38,10 +30,10 @@ final class ContactTable: Table {
|
|||||||
return peerIds
|
return peerIds
|
||||||
} else {
|
} else {
|
||||||
var peerIds = Set<PeerId>()
|
var peerIds = Set<PeerId>()
|
||||||
self.valueBox.range(self.table, start: self.lowerBound(), end: self.upperBound(), keys: { key in
|
self.valueBox.scan(self.table, keys: { key in
|
||||||
peerIds.insert(PeerId(key.getInt64(0)))
|
peerIds.insert(PeerId(key.getInt64(0)))
|
||||||
return true
|
return true
|
||||||
}, limit: 0)
|
})
|
||||||
self.peerIds = peerIds
|
self.peerIds = peerIds
|
||||||
return peerIds
|
return peerIds
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user