Proposed version 1

This commit is contained in:
Bin Liu 2016-01-20 02:34:12 -08:00
parent da2cbf4644
commit bc92c64e8c
2 changed files with 7 additions and 11 deletions

View File

@ -423,14 +423,12 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)insertSections:(NSIndexSet *)sections
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewInsertingSectionsAtIndexSet:sections];
[_dataController insertSections:sections withAnimationOptions:kASCollectionViewAnimationNone];
}
- (void)deleteSections:(NSIndexSet *)sections
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewDeletingSectionsAtIndexSet:sections];
[_dataController deleteSections:sections withAnimationOptions:kASCollectionViewAnimationNone];
}
@ -449,7 +447,6 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)insertItemsAtIndexPaths:(NSArray *)indexPaths
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewInsertingCellAtIndexPaths:indexPaths];
[_dataController insertRowsAtIndexPaths:indexPaths withAnimationOptions:kASCollectionViewAnimationNone];
}
@ -847,7 +844,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)rangeController:(ASRangeController *)rangeController didEndUpdatesAnimated:(BOOL)animated completion:(void (^)(BOOL))completion
{
ASDisplayNodeAssertMainThread();
if (!self.asyncDataSource || _superIsPendingDataLoad) {
if (completion) {
completion(NO);
@ -870,7 +867,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)rangeController:(ASRangeController *)rangeController didInsertNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewEditingCellsAtIndexPaths:indexPaths];
if (!self.asyncDataSource || _superIsPendingDataLoad) {
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}
@ -889,7 +886,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)rangeController:(ASRangeController *)rangeController didDeleteNodes:(NSArray *)nodes atIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewEditingCellsAtIndexPaths:indexPaths];
if (!self.asyncDataSource || _superIsPendingDataLoad) {
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}
@ -908,7 +905,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)rangeController:(ASRangeController *)rangeController didInsertSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewEditingSectionsAtIndexSet:indexSet];
if (!self.asyncDataSource || _superIsPendingDataLoad) {
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}
@ -927,7 +924,7 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell";
- (void)rangeController:(ASRangeController *)rangeController didDeleteSectionsAtIndexSet:(NSIndexSet *)indexSet withAnimationOptions:(ASDataControllerAnimationOptions)animationOptions
{
ASDisplayNodeAssertMainThread();
[_layoutFacilitator collectionViewEditingSectionsAtIndexSet:indexSet];
if (!self.asyncDataSource || _superIsPendingDataLoad) {
return; // if the asyncDataSource has become invalid while we are processing, ignore this request to avoid crashes
}

View File

@ -11,9 +11,8 @@
@protocol ASCollectionViewLayoutFacilitatorProtocol <NSObject>
- (void)collectionViewInsertingCellAtIndexPaths:(NSArray *)indexPaths;
- (void)collectionViewInsertingSectionsAtIndexSet:(NSIndexSet *)indexes;
- (void)collectionViewDeletingSectionsAtIndexSet:(NSIndexSet *)indexes;
- (void)collectionViewEditingCellsAtIndexPaths:(NSArray *)indexPaths;
- (void)collectionViewEditingSectionsAtIndexSet:(NSIndexSet *)indexes;
@end