Comment improvements

This commit is contained in:
Ali
2020-09-15 22:21:35 +04:00
parent c368f569ee
commit 43281e1546
56 changed files with 5184 additions and 4275 deletions

View File

@@ -13,6 +13,7 @@ private enum MetadataPrefix: Int8 {
case ShouldReindexUnreadCountsState = 10
case TotalUnreadCountStates = 11
case PeerHistoryTagInitialized = 12
case PeerHistoryThreadHoleIndexInitialized = 13
}
public struct ChatListTotalUnreadCounters: PostboxCoding, Equatable {
@@ -45,6 +46,7 @@ final class MessageHistoryMetadataTable: Table {
}
let sharedPeerHistoryInitializedKey = ValueBoxKey(length: 8 + 1)
let sharedPeerThreadHoleIndexInitializedKey = ValueBoxKey(length: 8 + 1 + 8)
let sharedGroupFeedIndexInitializedKey = ValueBoxKey(length: 4 + 1)
let sharedChatListGroupHistoryInitializedKey = ValueBoxKey(length: 4 + 1)
let sharedPeerNextMessageIdByNamespaceKey = ValueBoxKey(length: 8 + 1 + 4)
@@ -76,6 +78,12 @@ final class MessageHistoryMetadataTable: Table {
return self.sharedPeerHistoryInitializedKey
}
private func peerThreadHoleIndexInitializedKey(peerId: PeerId, threadId: Int64) -> ValueBoxKey {
self.sharedPeerThreadHoleIndexInitializedKey.setInt64(0, value: peerId.toInt64())
self.sharedPeerThreadHoleIndexInitializedKey.setInt8(8, value: MetadataPrefix.PeerHistoryThreadHoleIndexInitialized.rawValue)
return self.sharedPeerThreadHoleIndexInitializedKey
}
private func peerHistoryInitializedTagKey(id: PeerId, tag: UInt32) -> ValueBoxKey {
let key = ValueBoxKey(length: 8 + 1 + 4)
key.setInt64(0, value: id.toInt64())
@@ -211,6 +219,18 @@ final class MessageHistoryMetadataTable: Table {
}
}
func isThreadHoleIndexInitialized(peerId: PeerId, threadId: Int64) -> Bool {
if self.valueBox.exists(self.table, key: self.peerThreadHoleIndexInitializedKey(peerId: peerId, threadId: threadId)) {
return true
} else {
return false
}
}
func setIsThreadHoleIndexInitialized(peerId: PeerId, threadId: Int64) {
self.valueBox.set(self.table, key: self.peerThreadHoleIndexInitializedKey(peerId: peerId, threadId: threadId), value: MemoryBuffer())
}
func setPeerTagInitialized(peerId: PeerId, tag: MessageTags) {
if self.initializedHistoryPeerIdTags[peerId] == nil {
self.initializedHistoryPeerIdTags[peerId] = Set()