mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Revisions based on feedback
This commit is contained in:
@@ -384,13 +384,13 @@ static BOOL _isInterceptedSelector(SEL sel)
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldFetchBatch
|
||||
- (BOOL)shouldBatchFetch
|
||||
{
|
||||
if ([self.asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]) {
|
||||
return [self.asyncDelegate shouldBatchFetchForCollectionView:self];
|
||||
if ([_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]) {
|
||||
return [_asyncDelegate shouldBatchFetchForCollectionView:self];
|
||||
} else {
|
||||
// if the delegate does not respond to this method, there is no point in starting to fetch
|
||||
return [self.asyncDelegate respondsToSelector:@selector(collectionView:beginBatchFetchingWithContext:)];
|
||||
return [_asyncDelegate respondsToSelector:@selector(collectionView:willBeginBatchFetchWithContext:)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,13 +398,15 @@ static BOOL _isInterceptedSelector(SEL sel)
|
||||
{
|
||||
ASDisplayNodeAssert(_batchContext != nil, @"Batch context should exist");
|
||||
|
||||
if (![self shouldFetchBatch]) {
|
||||
if (![self shouldBatchFetch]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ASDisplayShouldFetchBatchForContext(_batchContext, [self scrollDirection], self.bounds, self.contentSize, targetOffset, _leadingScreensForBatching)) {
|
||||
[_batchContext beginBatchFetching];
|
||||
[self.asyncDelegate collectionView:self beginBatchFetchingWithContext:_batchContext];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[_asyncDelegate collectionView:self willBeginBatchFetchWithContext:_batchContext];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user