mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Beter table/collection update history (#2562)
- Introduce thread-safe ASEventLog - ASCollectionNode and ASTableNode share their event log with their ASDataController. The controller uses it to log change set submitting and finishing events. - ASCollectionNode and ASTableNode print their data source and delegate in their debug description.
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
|
||||
[_changeSet addCompletionHandler:completion];
|
||||
if (_changeSetBatchUpdateCounter == 0) {
|
||||
void (^batchCompletion)(BOOL finished) = _changeSet.completionHandler;
|
||||
void (^batchCompletion)(BOOL) = _changeSet.completionHandler;
|
||||
|
||||
/**
|
||||
* If the initial reloadData has not been called, just bail because we don't have
|
||||
@@ -66,6 +66,8 @@
|
||||
[self invalidateDataSourceItemCounts];
|
||||
[_changeSet markCompletedWithNewItemCounts:[self itemCountsFromDataSource]];
|
||||
|
||||
ASDataControllerLogEvent(self, @"triggeredUpdate: %@", _changeSet);
|
||||
|
||||
[super beginUpdates];
|
||||
|
||||
for (_ASHierarchyItemChange *change in [_changeSet itemChangesOfType:_ASHierarchyChangeTypeDelete]) {
|
||||
@@ -84,6 +86,16 @@
|
||||
[super insertRowsAtIndexPaths:change.indexPaths withAnimationOptions:change.animationOptions];
|
||||
}
|
||||
|
||||
#if ASEVENTLOG_ENABLE
|
||||
NSString *changeSetDescription = ASObjectDescriptionMakeTiny(_changeSet);
|
||||
batchCompletion = ^(BOOL finished) {
|
||||
if (batchCompletion != nil) {
|
||||
batchCompletion(finished);
|
||||
}
|
||||
ASDataControllerLogEvent(self, @"finishedUpdate: %@", changeSetDescription);
|
||||
};
|
||||
#endif
|
||||
|
||||
[super endUpdatesAnimated:animated completion:batchCompletion];
|
||||
|
||||
_changeSet = nil;
|
||||
|
||||
Reference in New Issue
Block a user