Skip to content

Commit

Permalink
Add more info in IGListAdapterUpdater willPerformBatchUpdates call
Browse files Browse the repository at this point in the history
Summary: Provide additional context in willPerformBatchUpdates, which can be useful for debugging.

Reviewed By: lorixx

Differential Revision: D10436588

fbshipit-source-id: a59803affc24ca20f7726e36117df6126b984afb
  • Loading branch information
Jeremy Cohen authored and facebook-github-bot committed Oct 21, 2018
1 parent 13d22fb commit b200dda
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 78 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

- All `IGListBindingSectionControllerSelectionDelegate` methods are now required. [Bofei Zhu] (https://github.com/zhubofei) [(#1186)](https://github.com/Instagram/IGListKit/pull/1186)

- Renamed `[IGListAdapterUpdatingDelegate listAdapterUpdater:willPerformBatchUpdatesWithCollectionView:]` to `[IGListAdapterUpdatingDelegate listAdapterUpdater:willPerformBatchUpdatesWithCollectionView:fromObjects:toObjects:listIndexSetResult:]` to include more supporting info on updated objects. [Jeremy Cohen] (https://github.com/jeremycohen) (tbd)

### Enhancements

- Added `IGListCollectionScrollingTraits` for exposing `UICollectionView` scrolling traits to section controllers via `IGListCollectionContext`. [Adam Stern](https://github.com/adamastern) (tbd)
Expand Down
6 changes: 5 additions & 1 deletion Source/IGListAdapterUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ - (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)co
[collectionView layoutIfNeeded];

@try {
[delegate listAdapterUpdater:self willPerformBatchUpdatesWithCollectionView:collectionView];
[delegate listAdapterUpdater:self
willPerformBatchUpdatesWithCollectionView:collectionView
fromObjects:fromObjects
toObjects:toObjects
listIndexSetResult:result];
if (result.changeCount > 100 && IGListExperimentEnabled(experiments, IGListExperimentReloadDataFallback)) {
reloadDataFallback();
} else if (animated) {
Expand Down
12 changes: 11 additions & 1 deletion Source/IGListAdapterUpdaterDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#import <IGListKit/IGListBatchUpdateData.h>

@class IGListAdapterUpdater;
@class IGListBatchUpdates;
@class IGListIndexSetResult;
@protocol IGListDiffable;

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -24,8 +27,15 @@ NS_SWIFT_NAME(ListAdapterUpdaterDelegate)
@param listAdapterUpdater The adapter updater owning the transition.
@param collectionView The collection view that will perform the batch updates.
@param fromObjects The items transitioned from in the batch updates, if any.
@param toObjects The items transitioned to in the batch updates, if any.
@param listIndexSetResults The diffing result of indices to be inserted/removed/updated/moved/etc.
*/
- (void)listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater willPerformBatchUpdatesWithCollectionView:(UICollectionView *)collectionView;
- (void) listAdapterUpdater:(IGListAdapterUpdater *)listAdapterUpdater
willPerformBatchUpdatesWithCollectionView:(UICollectionView *)collectionView
fromObjects:(nullable NSArray <id<IGListDiffable>> *)fromObjects
toObjects:(nullable NSArray <id<IGListDiffable>> *)toObjects
listIndexSetResult:(nullable IGListIndexSetResult *)listIndexSetResults;

/**
Notifies the delegate that the updater successfully finished `-[UICollectionView performBatchUpdates:completion:]`.
Expand Down
Loading

0 comments on commit b200dda

Please sign in to comment.