Updates ASDKGram to use IGListKit 3.0.0 (#367)

This commit is contained in:
Andrew Yates
2017-06-17 23:01:54 -07:00
committed by appleguy
parent d9dec8fdf9
commit 46c4359cc1
6 changed files with 9 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0' platform :ios, '8.0'
target 'ASDKListKitTests' do target 'ASDKListKitTests' do
pod 'Texture/IGListKit', :path => '..' pod 'Texture/IGListKit', :path => '..'
pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit', :commit => 'e9e09d7' pod 'IGListKit', :git => 'https://github.com/Instagram/IGListKit', :commit => '357a28e'
pod 'JGMethodSwizzler', :git => 'https://github.com/JonasGessner/JGMethodSwizzler', :branch => 'master' pod 'JGMethodSwizzler', :git => 'https://github.com/JonasGessner/JGMethodSwizzler', :branch => 'master'
end end

View File

@@ -51,7 +51,7 @@ Pod::Spec.new do |spec|
end end
spec.subspec 'IGListKit' do |igl| spec.subspec 'IGListKit' do |igl|
igl.dependency 'IGListKit', '2.1.0' igl.dependency 'IGListKit', '3.0.0'
igl.dependency 'Texture/Core' igl.dependency 'Texture/Core'
end end

View File

@@ -52,25 +52,19 @@
return; return;
} }
BOOL wasEmpty = (self.items.count == 0);
dispatch_async(self.diffingQueue, ^{ dispatch_async(self.diffingQueue, ^{
IGListIndexSetResult *result = IGListDiff(self.pendingItems, newItems, IGListDiffPointerPersonality); IGListIndexSetResult *result = IGListDiff(self.pendingItems, newItems, IGListDiffPointerPersonality);
self.pendingItems = newItems; self.pendingItems = newItems;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
id<IGListCollectionContext> ctx = self.collectionContext; id<IGListCollectionContext> ctx = self.collectionContext;
[ctx performBatchAnimated:animated updates:^{ [ctx performBatchAnimated:animated updates:^(id<IGListBatchContext> _Nonnull batchContext) {
[ctx insertInSectionController:(id)self atIndexes:result.inserts]; [batchContext insertInSectionController:(id)self atIndexes:result.inserts];
[ctx deleteInSectionController:(id)self atIndexes:result.deletes]; [batchContext deleteInSectionController:(id)self atIndexes:result.deletes];
_items = newItems; _items = newItems;
} completion:^(BOOL finished) { } completion:^(BOOL finished) {
if (completion) { if (completion) {
completion(); completion();
} }
// WORKAROUND for https://github.com/Instagram/IGListKit/issues/378
if (wasEmpty) {
[(IGListAdapter *)ctx performUpdatesAnimated:NO completion:nil];
}
}]; }];
}); });
}); });

View File

@@ -65,7 +65,7 @@
{ {
// Ask the first section controller to do the refreshing. // Ask the first section controller to do the refreshing.
id<RefreshingSectionControllerType> secCtrl = [self.listAdapter sectionControllerForObject:self.photoFeed]; id<RefreshingSectionControllerType> secCtrl = [self.listAdapter sectionControllerForObject:self.photoFeed];
if ([secCtrl conformsToProtocol:@protocol(RefreshingSectionControllerType)]) { if ([(NSObject*)secCtrl conformsToProtocol:@protocol(RefreshingSectionControllerType)]) {
[secCtrl refreshContentWithCompletion:^{ [secCtrl refreshContentWithCompletion:^{
[self.refreshCtrl endRefreshing]; [self.refreshCtrl endRefreshing];
}]; }];
@@ -93,7 +93,7 @@
return self.spinner; return self.spinner;
} }
- (IGListSectionController <IGListSectionType> *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object - (IGListSectionController *)listAdapter:(IGListAdapter *)listAdapter sectionControllerForObject:(id)object
{ {
if ([object isKindOfClass:[PhotoFeedModel class]]) { if ([object isKindOfClass:[PhotoFeedModel class]]) {
return [[PhotoFeedSectionController alloc] init]; return [[PhotoFeedSectionController alloc] init];

View File

@@ -15,7 +15,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface PhotoFeedSectionController : ASCollectionSectionController <IGListSectionType, ASSectionController, RefreshingSectionControllerType> @interface PhotoFeedSectionController : ASCollectionSectionController <ASSectionController, RefreshingSectionControllerType>
@property (nonatomic, strong, nullable) PhotoFeedModel *photoFeed; @property (nonatomic, strong, nullable) PhotoFeedModel *photoFeed;

View File

@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@protocol RefreshingSectionControllerType <IGListSectionType> @protocol RefreshingSectionControllerType
- (void)refreshContentWithCompletion:(nullable void(^)())completion; - (void)refreshContentWithCompletion:(nullable void(^)())completion;