|
|
|
@ -2884,7 +2884,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
for (YapDatabaseViewRowChange *rowChange in rowChanges) {
|
|
|
|
|
switch (rowChange.type) {
|
|
|
|
|
case YapDatabaseViewChangeDelete: {
|
|
|
|
|
DDLogVerbose(@"YapDatabaseViewChangeDelete: %@, %@", rowChange.collectionKey, rowChange.indexPath);
|
|
|
|
|
DDLogInfo(@"YapDatabaseViewChangeDelete: %@, %@", rowChange.collectionKey, rowChange.indexPath);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
[self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]];
|
|
|
|
|
[rowsThatChangedSize removeObject:@(rowChange.indexPath.row)];
|
|
|
|
|
YapCollectionKey *collectionKey = rowChange.collectionKey;
|
|
|
|
@ -2892,8 +2893,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case YapDatabaseViewChangeInsert: {
|
|
|
|
|
DDLogVerbose(
|
|
|
|
|
@"YapDatabaseViewChangeInsert: %@, %@", rowChange.collectionKey, rowChange.newIndexPath);
|
|
|
|
|
DDLogInfo(@"YapDatabaseViewChangeInsert: %@, %@", rowChange.collectionKey, rowChange.newIndexPath);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
[self.collectionView insertItemsAtIndexPaths:@[ rowChange.newIndexPath ]];
|
|
|
|
|
[rowsThatChangedSize removeObject:@(rowChange.newIndexPath.row)];
|
|
|
|
|
|
|
|
|
@ -2908,16 +2909,18 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case YapDatabaseViewChangeMove: {
|
|
|
|
|
DDLogVerbose(@"YapDatabaseViewChangeMove: %@, %@, %@",
|
|
|
|
|
DDLogInfo(@"YapDatabaseViewChangeMove: %@, %@, %@",
|
|
|
|
|
rowChange.collectionKey,
|
|
|
|
|
rowChange.indexPath,
|
|
|
|
|
rowChange.newIndexPath);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
[self.collectionView deleteItemsAtIndexPaths:@[ rowChange.indexPath ]];
|
|
|
|
|
[self.collectionView insertItemsAtIndexPaths:@[ rowChange.newIndexPath ]];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case YapDatabaseViewChangeUpdate: {
|
|
|
|
|
DDLogVerbose(@"YapDatabaseViewChangeUpdate: %@, %@", rowChange.collectionKey, rowChange.indexPath);
|
|
|
|
|
DDLogInfo(@"YapDatabaseViewChangeUpdate: %@, %@", rowChange.collectionKey, rowChange.indexPath);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
[self.collectionView reloadItemsAtIndexPaths:@[ rowChange.indexPath ]];
|
|
|
|
|
[rowsThatChangedSize removeObject:@(rowChange.indexPath.row)];
|
|
|
|
|
break;
|
|
|
|
@ -2929,8 +2932,10 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
// as they may affect which cells show "date" headers or "status" footers.
|
|
|
|
|
NSMutableArray<NSIndexPath *> *rowsToReload = [NSMutableArray new];
|
|
|
|
|
for (NSNumber *row in rowsThatChangedSize) {
|
|
|
|
|
DDLogInfo(@"YapDatabaseViewChange reload other row: %@", row);
|
|
|
|
|
[rowsToReload addObject:[NSIndexPath indexPathForRow:row.integerValue inSection:0]];
|
|
|
|
|
}
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
[self.collectionView reloadItemsAtIndexPaths:rowsToReload];
|
|
|
|
|
};
|
|
|
|
|
void (^batchUpdatesCompletion)(BOOL) = ^(BOOL finished) {
|
|
|
|
@ -2947,6 +2952,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DDLogInfo(@"Before performBatchUpdates: %d", shouldAnimateUpdates);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
if (shouldAnimateUpdates) {
|
|
|
|
|
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
|
|
|
|
|
} else {
|
|
|
|
@ -2954,6 +2961,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|
|
|
|
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
DDLogInfo(@"After performBatchUpdates");
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL)shouldAnimateRowUpdates:(NSArray<YapDatabaseViewRowChange *> *)rowChanges
|
|
|
|
|