update cached data after service messages for chat background

This commit is contained in:
Mike Renoir 2023-04-06 15:37:27 +04:00
parent dc7541dada
commit 184a02baaa

View File

@ -3405,6 +3405,20 @@ func replayFinalState(
for (space, _) in holesAtHistoryStart {
transaction.removeHole(peerId: chatPeerId, threadId: nil, namespace: Namespaces.Message.Cloud, space: space, range: 1 ... id.id)
}
case let .setChatWallpaper(wallpaper):
transaction.updatePeerCachedData(peerIds: [message.id.peerId], update: { peerId, current in
var current = current
if current == nil {
if peerId.namespace == Namespaces.Peer.CloudUser {
current = CachedUserData()
}
}
if let cachedData = current as? CachedUserData {
return cachedData.withUpdatedWallpaper(wallpaper)
} else {
return current
}
})
default:
break
}