From 85f6d05e0f6da2d2f5b642c4dc59c1bc717da983 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 10 Dec 2018 12:02:18 -0500 Subject: [PATCH] Refine view model diffing. --- .../ConversationView/ConversationViewModel.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m b/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m index 26730524b..c9720df78 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewModel.m @@ -759,6 +759,17 @@ static const int kYapDatabaseRangeMinLength = 0; return [self.delegate conversationViewModelDidUpdate:ConversationUpdate.reloadUpdate]; } + // In addition to "update" items from the database change notification, + // we may need to update other items. One example is neighbors of modified + // cells. Another is cells whose appearance has changed due to the passage + // of time. We detect "dirty" items by whether or not they have cached layout + // state, since that is cleared whenever we change the properties of the + // item that affect its appearance. + // + // This replaces the setCellDrawingDependencyOffsets/ + // YapDatabaseViewChangedDependency logic offered by YDB mappings, + // which only reflects changes in the data store, not at the view + // level. NSMutableSet *updatedItemSet = [updatedItemSetParam mutableCopy]; NSMutableSet *updatedNeighborItemSet = [NSMutableSet new]; for (NSString *itemId in newItemIdSet) {