Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
@@ -0,0 +1,67 @@
import Foundation
final class MutableAllChatListHolesView: MutablePostboxView {
fileprivate let groupId: PeerGroupId
private var holes = Set<ChatListHole>()
fileprivate var latestHole: ChatListHole?
init(postbox: PostboxImpl, groupId: PeerGroupId) {
self.groupId = groupId
self.holes = Set(postbox.chatListTable.allHoles(groupId: groupId))
self.latestHole = self.holes.max(by: { $0.index < $1.index })
}
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
if let operations = transaction.chatListOperations[self.groupId] {
var updated = false
for operation in operations {
switch operation {
case let .InsertHole(hole):
if !self.holes.contains(hole) {
self.holes.insert(hole)
updated = true
}
case let .RemoveHoles(indices):
for index in indices {
if self.holes.contains(ChatListHole(index: index.messageIndex)) {
self.holes.remove(ChatListHole(index: index.messageIndex))
updated = true
}
}
default:
break
}
}
if updated {
let updatedLatestHole = self.holes.max(by: { $0.index < $1.index })
if updatedLatestHole != self.latestHole {
self.latestHole = updatedLatestHole
return true
} else {
return false
}
} else {
return false
}
} else {
return false
}
}
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
return false
}
func immutableView() -> PostboxView {
return AllChatListHolesView(self)
}
}
public final class AllChatListHolesView: PostboxView {
public let latestHole: ChatListHole?
init(_ view: MutableAllChatListHolesView) {
self.latestHole = view.latestHole
}
}