Fix edge cases in conversation view.

This commit is contained in:
Matthew Chen 2017-11-15 12:37:24 -05:00
parent 9aeaa00f62
commit 86fdd6dea2
1 changed files with 4 additions and 2 deletions

View File

@ -2902,7 +2902,6 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
case YapDatabaseViewChangeDelete: {
DDLogVerbose(@"YapDatabaseViewChangeDelete: %@, %@", rowChange.collectionKey, rowChange.indexPath);
[self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]];
[rowsThatChangedSize removeObject:@(rowChange.indexPath.row)];
YapCollectionKey *collectionKey = rowChange.collectionKey;
OWSAssert(collectionKey.key.length > 0);
break;
@ -2930,6 +2929,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
rowChange.newIndexPath);
[self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]];
[self.collectionView insertItemsAtIndexPaths:@[ rowChange.newIndexPath ]];
[rowsThatChangedSize removeObject:@(rowChange.newIndexPath.row)];
break;
}
case YapDatabaseViewChangeUpdate: {
@ -2947,7 +2947,9 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
for (NSNumber *row in rowsThatChangedSize) {
[rowsToReload addObject:[NSIndexPath indexPathForRow:row.integerValue inSection:0]];
}
[self.collectionView reloadItemsAtIndexPaths:rowsToReload];
if (rowsToReload.count > 0) {
[self.collectionView reloadItemsAtIndexPaths:rowsToReload];
}
};
void (^batchUpdatesCompletion)(BOOL) = ^(BOOL finished) {
OWSAssert([NSThread isMainThread]);