mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Disable asyncDataFetching in ASTableView and ASCollectionView init methods.
It's currently unreliable for some use cases that issue editing calls while content is displayed or being interacted with. The performance gain is not sufficient to sacrifice correctness for the clients that hit this issue, so it will remain off until fully resolved.
This commit is contained in:
@@ -137,6 +137,10 @@ static BOOL _isInterceptedSelector(SEL sel)
|
|||||||
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
|
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
// FIXME: asyncDataFetching is currently unreliable for some use cases.
|
||||||
|
// https://github.com/facebook/AsyncDisplayKit/issues/385
|
||||||
|
asyncDataFetchingEnabled = NO;
|
||||||
|
|
||||||
ASDisplayNodeAssert([layout isKindOfClass:UICollectionViewFlowLayout.class], @"only flow layouts are currently supported");
|
ASDisplayNodeAssert([layout isKindOfClass:UICollectionViewFlowLayout.class], @"only flow layouts are currently supported");
|
||||||
|
|
||||||
ASFlowLayoutDirection direction = (((UICollectionViewFlowLayout *)layout).scrollDirection == UICollectionViewScrollDirectionHorizontal) ? ASFlowLayoutDirectionHorizontal : ASFlowLayoutDirectionVertical;
|
ASFlowLayoutDirection direction = (((UICollectionViewFlowLayout *)layout).scrollDirection == UICollectionViewScrollDirectionHorizontal) ? ASFlowLayoutDirectionHorizontal : ASFlowLayoutDirectionVertical;
|
||||||
@@ -165,8 +169,10 @@ static BOOL _isInterceptedSelector(SEL sel)
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
- (void)dealloc
|
||||||
// a little defense move here.
|
{
|
||||||
|
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
|
||||||
|
// This bug might be iOS 7-specific.
|
||||||
super.delegate = nil;
|
super.delegate = nil;
|
||||||
super.dataSource = nil;
|
super.dataSource = nil;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,8 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark Lifecycle
|
#pragma mark Lifecycle
|
||||||
|
|
||||||
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled {
|
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled
|
||||||
|
{
|
||||||
_layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical];
|
_layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical];
|
||||||
|
|
||||||
_rangeController = [[ASRangeController alloc] init];
|
_rangeController = [[ASRangeController alloc] init];
|
||||||
@@ -185,12 +186,17 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
|
|||||||
if (!(self = [super initWithFrame:frame style:style]))
|
if (!(self = [super initWithFrame:frame style:style]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
// FIXME: asyncDataFetching is currently unreliable for some use cases.
|
||||||
|
// https://github.com/facebook/AsyncDisplayKit/issues/385
|
||||||
|
asyncDataFetchingEnabled = NO;
|
||||||
|
|
||||||
[self configureWithAsyncDataFetching:asyncDataFetchingEnabled];
|
[self configureWithAsyncDataFetching:asyncDataFetchingEnabled];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
|
- (instancetype)initWithCoder:(NSCoder *)aDecoder
|
||||||
|
{
|
||||||
if (!(self = [super initWithCoder:aDecoder]))
|
if (!(self = [super initWithCoder:aDecoder]))
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
@@ -199,8 +205,10 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc {
|
- (void)dealloc
|
||||||
// a little defense move here.
|
{
|
||||||
|
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
|
||||||
|
// This bug might be iOS 7-specific.
|
||||||
super.delegate = nil;
|
super.delegate = nil;
|
||||||
super.dataSource = nil;
|
super.dataSource = nil;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user