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,69 @@
import Foundation
final class MutableItemCollectionInfoView: MutablePostboxView {
let id: ItemCollectionId
var info: ItemCollectionInfo?
init(postbox: PostboxImpl, id: ItemCollectionId) {
self.id = id
let infos = postbox.itemCollectionInfoTable.getInfos(namespace: id.namespace)
for (_, infoId, info) in infos {
if id == infoId {
self.info = info
break
}
}
}
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
if transaction.currentItemCollectionInfosOperations.isEmpty {
return false
}
var updated = false
var reloadInfosNamespaces = Set<ItemCollectionId.Namespace>()
for operation in transaction.currentItemCollectionInfosOperations {
switch operation {
case let .replaceInfos(namespace):
reloadInfosNamespaces.insert(namespace)
}
}
if !reloadInfosNamespaces.isEmpty && reloadInfosNamespaces.contains(self.id.namespace) {
updated = true
let infos = postbox.itemCollectionInfoTable.getInfos(namespace: id.namespace)
var found = false
for (_, infoId, info) in infos {
if id == infoId {
self.info = info
found = true
break
}
}
if !found {
self.info = nil
}
}
return updated
}
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
return false
}
func immutableView() -> PostboxView {
return ItemCollectionInfoView(self)
}
}
public final class ItemCollectionInfoView: PostboxView {
public let id: ItemCollectionId
public let info: ItemCollectionInfo?
init(_ view: MutableItemCollectionInfoView) {
self.id = view.id
self.info = view.info
}
}