mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-20 07:48:32 +00:00
Summary: There is one private method in IGListKit which isn't being called from anywhere. We should just remove it. Reviewed By: rnystrom Differential Revision: D8346790 fbshipit-source-id: b74766373ca6b9262e03c728b26b647e164fcb03
82 lines
3.3 KiB
Objective-C
82 lines
3.3 KiB
Objective-C
/**
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <IGListKit/IGListReloadDataUpdater.h>
|
|
|
|
@implementation IGListReloadDataUpdater
|
|
|
|
#pragma mark - IGListUpdatingDelegate
|
|
|
|
- (NSPointerFunctions *)objectLookupPointerFunctions {
|
|
return [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsObjectPersonality];
|
|
}
|
|
|
|
- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock
|
|
fromObjects:(NSArray *)fromObjects
|
|
toObjectsBlock:(IGListToObjectBlock)toObjectsBlock
|
|
animated:(BOOL)animated
|
|
objectTransitionBlock:(IGListObjectTransitionBlock)objectTransitionBlock
|
|
completion:(IGListUpdatingCompletion)completion {
|
|
if (toObjectsBlock != nil) {
|
|
NSArray *toObjects = toObjectsBlock() ?: @[];
|
|
objectTransitionBlock(toObjects);
|
|
}
|
|
[self _synchronousReloadDataWithCollectionView:collectionViewBlock()];
|
|
if (completion) {
|
|
completion(YES);
|
|
}
|
|
}
|
|
|
|
- (void)performUpdateWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock
|
|
animated:(BOOL)animated
|
|
itemUpdates:(IGListItemUpdateBlock)itemUpdates
|
|
completion:(IGListUpdatingCompletion)completion {
|
|
itemUpdates();
|
|
[self _synchronousReloadDataWithCollectionView:collectionViewBlock()];
|
|
if (completion) {
|
|
completion(YES);
|
|
}
|
|
}
|
|
|
|
- (void)insertItemsIntoCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray<NSIndexPath *> *)indexPaths {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)deleteItemsFromCollectionView:(UICollectionView *)collectionView indexPaths:(NSArray<NSIndexPath *> *)indexPaths {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)moveItemInCollectionView:(UICollectionView *)collectionView fromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)reloadItemInCollectionView:(UICollectionView *)collectionView fromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)moveSectionInCollectionView:(UICollectionView *)collectionView fromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)reloadDataWithCollectionViewBlock:(IGListCollectionViewBlock)collectionViewBlock reloadUpdateBlock:(IGListReloadUpdateBlock)reloadUpdateBlock completion:(IGListUpdatingCompletion)completion {
|
|
reloadUpdateBlock();
|
|
[self _synchronousReloadDataWithCollectionView:collectionViewBlock()];
|
|
if (completion) {
|
|
completion(YES);
|
|
}
|
|
}
|
|
|
|
- (void)reloadCollectionView:(UICollectionView *)collectionView sections:(NSIndexSet *)sections {
|
|
[self _synchronousReloadDataWithCollectionView:collectionView];
|
|
}
|
|
|
|
- (void)_synchronousReloadDataWithCollectionView:(UICollectionView *)collectionView {
|
|
[collectionView reloadData];
|
|
[collectionView layoutIfNeeded];
|
|
}
|
|
|
|
@end
|