From bbd3a3af925e659f0ce6ae2bcabf0fe35ae5bd52 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 5 Apr 2020 20:25:35 +0400 Subject: [PATCH] Add additional check [skip ci] --- submodules/Postbox/Sources/ChatListViewState.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/submodules/Postbox/Sources/ChatListViewState.swift b/submodules/Postbox/Sources/ChatListViewState.swift index 9f7c2ba58b..2940f0ea36 100644 --- a/submodules/Postbox/Sources/ChatListViewState.swift +++ b/submodules/Postbox/Sources/ChatListViewState.swift @@ -794,6 +794,7 @@ private final class ChatListViewSpaceState { } self.checkEntries(postbox: postbox) + self.checkReplayEntries(postbox: postbox) return hasUpdates } @@ -822,6 +823,14 @@ private final class ChatListViewSpaceState { #endif } + private func checkReplayEntries(postbox: Postbox) { + #if DEBUG + let cleanState = ChatListViewSpaceState(postbox: postbox, space: self.space, anchorIndex: self.anchorIndex, summaryComponents: self.summaryComponents, halfLimit: self.halfLimit) + assert(self.orderedEntries.lowerOrAtAnchor.map { $0.index } == cleanState.orderedEntries.lowerOrAtAnchor.map { $0.index }) + assert(self.orderedEntries.higherThanAnchor.map { $0.index } == cleanState.orderedEntries.higherThanAnchor.map { $0.index }) + #endif + } + private func add(entry: MutableChatListEntry) -> Bool { if self.anchorIndex >= entry.entryIndex { let insertionIndex = binaryInsertionIndex(self.orderedEntries.lowerOrAtAnchor, extract: { $0.entryIndex }, searchItem: entry.entryIndex)