Merge commit 'ba08ae1318cac3a40c4c0fe6c920e1675117dc2f'

This commit is contained in:
Peter
2017-08-04 13:12:11 +03:00
42 changed files with 566 additions and 322 deletions

View File

@@ -1475,19 +1475,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
#pragma mark - ASRangeControllerDelegate
- (void)rangeController:(ASRangeController *)rangeController willUpdateWithChangeSet:(_ASHierarchyChangeSet *)changeSet
{
ASDisplayNodeAssertMainThread();
if (!self.asyncDataSource) {
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}
if (_automaticallyAdjustsContentOffset && !changeSet.includesReloadData) {
[self beginAdjustingContentOffset];
}
}
- (void)rangeController:(ASRangeController *)rangeController didUpdateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates
- (void)rangeController:(ASRangeController *)rangeController updateWithChangeSet:(_ASHierarchyChangeSet *)changeSet updates:(dispatch_block_t)updates
{
ASDisplayNodeAssertMainThread();
if (!self.asyncDataSource || _updatingInResponseToInteractiveMove) {
@@ -1495,7 +1483,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
[changeSet executeCompletionHandlerWithFinished:NO];
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}
if (changeSet.includesReloadData) {
LOG(@"UITableView reloadData");
ASPerformBlockWithoutAnimation(!changeSet.animated, ^{
@@ -1511,6 +1499,11 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
});
return;
}
BOOL shouldAdjustContentOffset = (_automaticallyAdjustsContentOffset && !changeSet.includesReloadData);
if (shouldAdjustContentOffset) {
[self beginAdjustingContentOffset];
}
NSUInteger numberOfUpdates = 0;
@@ -1621,7 +1614,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
[_rangeController updateIfNeeded];
[self _scheduleCheckForBatchFetchingForNumberOfChanges:numberOfUpdates];
});
if (_automaticallyAdjustsContentOffset) {
if (shouldAdjustContentOffset) {
[self endAdjustingContentOffsetAnimated:changeSet.animated];
}
[changeSet executeCompletionHandlerWithFinished:YES];