mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Comment improvements
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user