Isolate postbox

This commit is contained in:
Ali
2021-09-22 01:56:45 +03:00
parent c808238571
commit d35acc8283
56 changed files with 744 additions and 182 deletions

View File

@@ -337,7 +337,7 @@ final class MutableChatListView {
private var additionalItems: [AdditionalChatListItem] = []
fileprivate var additionalItemEntries: [MutableChatListAdditionalItemEntry] = []
init(postbox: Postbox, groupId: PeerGroupId, filterPredicate: ChatListFilterPredicate?, aroundIndex: ChatListIndex, count: Int, summaryComponents: ChatListEntrySummaryComponents) {
init(postbox: PostboxImpl, groupId: PeerGroupId, filterPredicate: ChatListFilterPredicate?, aroundIndex: ChatListIndex, count: Int, summaryComponents: ChatListEntrySummaryComponents) {
self.groupId = groupId
self.filterPredicate = filterPredicate
self.summaryComponents = summaryComponents
@@ -382,7 +382,7 @@ final class MutableChatListView {
}
}
private func reloadGroups(postbox: Postbox) {
private func reloadGroups(postbox: PostboxImpl) {
self.groupEntries.removeAll()
if case .root = self.groupId, self.filterPredicate == nil {
for groupId in postbox.chatListTable.existingGroups() {
@@ -451,7 +451,7 @@ final class MutableChatListView {
}
}
func refreshDueToExternalTransaction(postbox: Postbox) -> Bool {
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
var updated = false
self.state = ChatListViewState(postbox: postbox, spaces: self.spaces, anchorIndex: .absoluteUpperBound, summaryComponents: self.summaryComponents, halfLimit: self.count)
@@ -469,7 +469,7 @@ final class MutableChatListView {
return updated
}
func replay(postbox: Postbox, operations: [PeerGroupId: [ChatListOperation]], updatedPeerNotificationSettings: [PeerId: (PeerNotificationSettings?, PeerNotificationSettings)], updatedPeers: [PeerId: Peer], updatedPeerPresences: [PeerId: PeerPresence], transaction: PostboxTransaction, context: MutableChatListViewReplayContext) -> Bool {
func replay(postbox: PostboxImpl, operations: [PeerGroupId: [ChatListOperation]], updatedPeerNotificationSettings: [PeerId: (PeerNotificationSettings?, PeerNotificationSettings)], updatedPeers: [PeerId: Peer], updatedPeerPresences: [PeerId: PeerPresence], transaction: PostboxTransaction, context: MutableChatListViewReplayContext) -> Bool {
var hasChanges = false
if transaction.updatedGlobalNotificationSettings && self.filterPredicate != nil {
@@ -551,7 +551,7 @@ final class MutableChatListView {
return hasChanges
}
func complete(postbox: Postbox, context: MutableChatListViewReplayContext) {
func complete(postbox: PostboxImpl, context: MutableChatListViewReplayContext) {
}
@@ -559,7 +559,7 @@ final class MutableChatListView {
return self.sampledState.hole
}
private func renderEntry(_ entry: MutableChatListEntry, postbox: Postbox) -> MutableChatListEntry? {
private func renderEntry(_ entry: MutableChatListEntry, postbox: PostboxImpl) -> MutableChatListEntry? {
switch entry {
case let .IntermediateMessageEntry(index, messageIndex):
var renderedMessages: [Message] = []
@@ -597,7 +597,7 @@ final class MutableChatListView {
}
}
func render(postbox: Postbox) {
func render(postbox: PostboxImpl) {
for i in 0 ..< self.additionalItemEntries.count {
if let updatedEntry = self.renderEntry(self.additionalItemEntries[i].entry, postbox: postbox) {
self.additionalItemEntries[i].entry = updatedEntry