[skip ci]

This commit is contained in:
overtake 2020-11-25 15:31:28 +04:00
parent 2eb6b4aa70
commit fb500a1345
3 changed files with 21 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#import <UIKit/UIKit.h> #import <Foundation/Foundation.h>
#import <FFMpegBinding/FFMpegGlobals.h> #import <FFMpegBinding/FFMpegGlobals.h>
#import <FFMpegBinding/FFMpegAVCodecContext.h> #import <FFMpegBinding/FFMpegAVCodecContext.h>

View File

@ -667,8 +667,12 @@ final class MutableMessageHistoryView {
var updatedCachedPeerDataMessages = false var updatedCachedPeerDataMessages = false
var currentCachedPeerData: CachedPeerData? var currentCachedPeerData: CachedPeerData?
for i in 0 ..< self.additionalDatas.count {
switch self.additionalDatas[i] { let additionalDatas = self.additionalDatas
var updated = self.additionalDatas
for i in 0 ..< additionalDatas.count {
switch additionalDatas[i] {
case let .cachedPeerData(peerId, currentData): case let .cachedPeerData(peerId, currentData):
currentCachedPeerData = currentData currentCachedPeerData = currentData
if let updatedData = transaction.currentUpdatedCachedPeerData[peerId] { if let updatedData = transaction.currentUpdatedCachedPeerData[peerId] {
@ -676,7 +680,7 @@ final class MutableMessageHistoryView {
updatedCachedPeerDataMessages = true updatedCachedPeerDataMessages = true
} }
currentCachedPeerData = updatedData currentCachedPeerData = updatedData
self.additionalDatas[i] = .cachedPeerData(peerId, updatedData) updated[i] = .cachedPeerData(peerId, updatedData)
hasChanges = true hasChanges = true
} }
case .cachedPeerDataMessages: case .cachedPeerDataMessages:
@ -729,13 +733,13 @@ final class MutableMessageHistoryView {
} }
if updateMessage { if updateMessage {
let messages = postbox.getMessageGroup(at: id) ?? [] let messages = postbox.getMessageGroup(at: id) ?? []
self.additionalDatas[i] = .message(id, messages) updated[i] = .message(id, messages)
hasChanges = true hasChanges = true
} }
} }
case let .peerChatState(peerId, _): case let .peerChatState(peerId, _):
if transaction.currentUpdatedPeerChatStates.contains(peerId) { if transaction.currentUpdatedPeerChatStates.contains(peerId) {
self.additionalDatas[i] = .peerChatState(peerId, postbox.peerChatStateTable.get(peerId) as? PeerChatState) updated[i] = .peerChatState(peerId, postbox.peerChatStateTable.get(peerId) as? PeerChatState)
hasChanges = true hasChanges = true
} }
case .totalUnreadState: case .totalUnreadState:
@ -744,7 +748,7 @@ final class MutableMessageHistoryView {
break break
case let .cacheEntry(entryId, _): case let .cacheEntry(entryId, _):
if transaction.updatedCacheEntryKeys.contains(entryId) { if transaction.updatedCacheEntryKeys.contains(entryId) {
self.additionalDatas[i] = .cacheEntry(entryId, postbox.retrieveItemCacheEntry(id: entryId)) updated[i] = .cacheEntry(entryId, postbox.retrieveItemCacheEntry(id: entryId))
hasChanges = true hasChanges = true
} }
case .preferencesEntry: case .preferencesEntry:
@ -759,20 +763,20 @@ final class MutableMessageHistoryView {
} }
if value != updatedValue { if value != updatedValue {
self.additionalDatas[i] = .peerIsContact(peerId, value) updated[i] = .peerIsContact(peerId, value)
hasChanges = true hasChanges = true
} }
} }
case let .peer(peerId, _): case let .peer(peerId, _):
if let peer = transaction.currentUpdatedPeers[peerId] { if let peer = transaction.currentUpdatedPeers[peerId] {
self.additionalDatas[i] = .peer(peerId, peer) updated[i] = .peer(peerId, peer)
hasChanges = true hasChanges = true
} }
} }
} }
if let cachedData = currentCachedPeerData, !cachedData.messageIds.isEmpty { if let cachedData = currentCachedPeerData, !cachedData.messageIds.isEmpty {
for i in 0 ..< self.additionalDatas.count { for i in 0 ..< additionalDatas.count {
switch self.additionalDatas[i] { switch additionalDatas[i] {
case .cachedPeerDataMessages(_, _): case .cachedPeerDataMessages(_, _):
outer: for operationSet in operations { outer: for operationSet in operations {
for operation in operationSet { for operation in operationSet {
@ -802,8 +806,8 @@ final class MutableMessageHistoryView {
if updatedCachedPeerDataMessages { if updatedCachedPeerDataMessages {
hasChanges = true hasChanges = true
for i in 0 ..< self.additionalDatas.count { for i in 0 ..< additionalDatas.count {
switch self.additionalDatas[i] { switch additionalDatas[i] {
case let .cachedPeerDataMessages(peerId, _): case let .cachedPeerDataMessages(peerId, _):
var messages: [MessageId: Message] = [:] var messages: [MessageId: Message] = [:]
if let cachedData = currentCachedPeerData { if let cachedData = currentCachedPeerData {
@ -813,13 +817,15 @@ final class MutableMessageHistoryView {
} }
} }
} }
self.additionalDatas[i] = .cachedPeerDataMessages(peerId, messages) updated[i] = .cachedPeerDataMessages(peerId, messages)
default: default:
break break
} }
} }
} }
self.additionalDatas = updated
if !transaction.currentPeerHoleOperations.isEmpty { if !transaction.currentPeerHoleOperations.isEmpty {
var holePeerIdsSet: [PeerId] = [] var holePeerIdsSet: [PeerId] = []
switch self.peerIds { switch self.peerIds {

@ -1 +1 @@
Subproject commit b245c575f350e13186d34b9ae38f6af555c6fe14 Subproject commit 64f96a1b4fcfb8afdb0fb7749082cb42cdad7901