Added preferencesEntry additional data item to MessageHistoryView

This commit is contained in:
Peter 2018-11-07 02:00:37 +04:00
parent 0f171b185e
commit 3acf98d4cc
2 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,7 @@ public enum AdditionalMessageHistoryViewData {
case totalUnreadState
case peerNotificationSettings(PeerId)
case cacheEntry(ItemCacheEntryId)
case preferencesEntry(ValueBoxKey)
case peer(PeerId)
case peerIsContact(PeerId)
}
@ -29,6 +30,7 @@ public enum AdditionalMessageHistoryViewDataEntry {
case totalUnreadState(ChatListTotalUnreadState)
case peerNotificationSettings(PeerNotificationSettings?)
case cacheEntry(ItemCacheEntryId, PostboxCoding?)
case preferencesEntry(ValueBoxKey, PreferencesEntry?)
case peerIsContact(PeerId, Bool)
case peer(PeerId, Peer?)
}
@ -1069,6 +1071,8 @@ final class MutableMessageHistoryView {
self.additionalDatas[i] = .cacheEntry(entryId, postbox.retrieveItemCacheEntry(id: entryId))
hasChanges = true
}
case .preferencesEntry:
break
case let .peerIsContact(peerId, value):
if let replacedPeerIds = transaction.replaceContactPeerIds {
let updatedValue: Bool

View File

@ -2545,6 +2545,8 @@ public final class Postbox {
additionalDataEntries.append(.peerNotificationSettings(self.peerNotificationSettingsTable.getEffective(notificationPeerId)))
case let .cacheEntry(entryId):
additionalDataEntries.append(.cacheEntry(entryId, self.retrieveItemCacheEntry(id: entryId)))
case let .preferencesEntry(key):
additionalDataEntries.append(.preferencesEntry(key, self.preferencesTable.get(key: key)))
case let .peerIsContact(peerId):
let value: Bool
if let contactPeer = self.peerTable.get(peerId), let associatedPeerId = contactPeer.associatedPeerId {