mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASCollectionView] When resizing, invalidate after remeasuring all nodes (#1931)
This commit is contained in:
@@ -100,7 +100,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
||||
id<ASCollectionViewLayoutFacilitatorProtocol> _layoutFacilitator;
|
||||
|
||||
BOOL _performingBatchUpdates;
|
||||
BOOL _superPerformingBatchUpdates;
|
||||
NSUInteger _superBatchUpdateCount;
|
||||
NSMutableArray *_batchUpdateBlocks;
|
||||
|
||||
BOOL _isDeallocating;
|
||||
@@ -518,11 +518,10 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
||||
- (void)_superPerformBatchUpdates:(void(^)())updates completion:(void(^)(BOOL finished))completion
|
||||
{
|
||||
ASDisplayNodeAssertMainThread();
|
||||
ASDisplayNodeAssert(_superPerformingBatchUpdates == NO, @"Nested batch updates being sent to UICollectionView. This is not expected.");
|
||||
|
||||
_superPerformingBatchUpdates = YES;
|
||||
_superBatchUpdateCount++;
|
||||
[super performBatchUpdates:updates completion:completion];
|
||||
_superPerformingBatchUpdates = NO;
|
||||
_superBatchUpdateCount--;
|
||||
}
|
||||
|
||||
#pragma mark Assertions.
|
||||
@@ -849,6 +848,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
||||
} completion:nil];
|
||||
// We need to ensure the size requery is done before we update our layout.
|
||||
[self waitUntilAllUpdatesAreCommitted];
|
||||
[self.collectionViewLayout invalidateLayout];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
|
||||
_nextLayoutInvalidationStyle = ASCollectionViewInvalidationStyleNone;
|
||||
switch (invalidationStyle) {
|
||||
case ASCollectionViewInvalidationStyleWithAnimation:
|
||||
if (!_superPerformingBatchUpdates) {
|
||||
if (0 == _superBatchUpdateCount) {
|
||||
[self _superPerformBatchUpdates:^{ } completion:nil];
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user