Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
@@ -0,0 +1,40 @@
import Foundation
final class PendingPeerNotificationSettingsIndexTable: Table {
static func tableSpec(_ id: Int32) -> ValueBoxTable {
return ValueBoxTable(id: id, keyType: .int64, compactValuesOnCreation: false)
}
private let sharedKey = ValueBoxKey(length: 8)
private var updatedPeerIds: [PeerId: Bool] = [:]
private func key(_ id: PeerId) -> ValueBoxKey {
self.sharedKey.setInt64(0, value: id.toInt64())
return self.sharedKey
}
private func get(peerId: PeerId) -> Bool {
if let _ = self.valueBox.get(self.table, key: self.key(peerId)) {
return true
} else {
return false
}
}
func getAll() -> [PeerId] {
var peerIds: [PeerId] = []
self.valueBox.scanInt64(self.table, values: { key, _ in
peerIds.append(PeerId(key))
return true
})
return peerIds
}
func set(peerId: PeerId, pending: Bool) {
if pending {
self.valueBox.set(self.table, key: self.key(peerId), value: MemoryBuffer())
} else {
self.valueBox.remove(self.table, key: self.key(peerId), secure: false)
}
}
}