Skip to content

Commit

Permalink
remove unused experiment param
Browse files Browse the repository at this point in the history
Summary: We pass `experiments` to places that don't need it, so lets clean that up.

Reviewed By: patters

Differential Revision: D23145782

fbshipit-source-id: affcfe0f38d1b8e544940af89e5692dbdc36dd76
  • Loading branch information
maxolls authored and facebook-github-bot committed Sep 8, 2020
1 parent 0769da4 commit 254c041
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 78 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag

### Breaking Changes

- Removed unneeded diffing functions `IGListDiffExperiment(...)` and `IGListDiffPathsExperiment(...)`. [Maxime Ollivier](https://github.com/maxolls) (tbd)

### Enhancements

Expand Down
24 changes: 3 additions & 21 deletions Source/IGListDiffKit/IGListDiff.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#import <vector>

#import <IGListDiffKit/IGListCompatibility.h>
#import <IGListDiffKit/IGListExperiments.h>

#import "IGListIndexPathResultInternal.h"
#import "IGListIndexSetResultInternal.h"
Expand Down Expand Up @@ -96,8 +95,7 @@ static id IGListDiffing(BOOL returnIndexPaths,
NSInteger toSection,
NSArray<id<IGListDiffable>> *oldArray,
NSArray<id<IGListDiffable>> *newArray,
IGListDiffOption option,
IGListExperiment experiments) {
IGListDiffOption option) {
const NSInteger newCount = newArray.count;
const NSInteger oldCount = oldArray.count;

Expand Down Expand Up @@ -320,29 +318,13 @@ static id IGListDiffing(BOOL returnIndexPaths,
IGListIndexSetResult *IGListDiff(NSArray<id<IGListDiffable> > *oldArray,
NSArray<id<IGListDiffable>> *newArray,
IGListDiffOption option) {
return IGListDiffing(NO, 0, 0, oldArray, newArray, option, 0);
return IGListDiffing(NO, 0, 0, oldArray, newArray, option);
}

IGListIndexPathResult *IGListDiffPaths(NSInteger fromSection,
NSInteger toSection,
NSArray<id<IGListDiffable>> *oldArray,
NSArray<id<IGListDiffable>> *newArray,
IGListDiffOption option) {
return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, 0);
}

IGListIndexSetResult *IGListDiffExperiment(NSArray<id<IGListDiffable>> *_Nullable oldArray,
NSArray<id<IGListDiffable>> *_Nullable newArray,
IGListDiffOption option,
IGListExperiment experiments) {
return IGListDiffing(NO, 0, 0, oldArray, newArray, option, experiments);
}

IGListIndexPathResult *IGListDiffPathsExperiment(NSInteger fromSection,
NSInteger toSection,
NSArray<id<IGListDiffable>> *_Nullable oldArray,
NSArray<id<IGListDiffable>> *_Nullable newArray,
IGListDiffOption option,
IGListExperiment experiments) {
return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, experiments);
return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option);
}
40 changes: 0 additions & 40 deletions Source/IGListDiffKit/IGListExperiments.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,4 @@ static inline BOOL IGListExperimentEnabled(IGListExperiment mask, IGListExperime

NS_ASSUME_NONNULL_BEGIN

/**
Performs an index diff with an experiment bitmask.
@param oldArray The old array of objects.
@param newArray The new array of objects.
@param option Option to specify the type of diff.
@param experiments Optional experiments.
@return An index set result object contained the changed indexes.
@see `IGListDiff()`.
*/
NS_SWIFT_NAME(ListDiffExperiment(oldArray:newArray:option:experiments:))
FOUNDATION_EXTERN IGListIndexSetResult *IGListDiffExperiment(NSArray<id<IGListDiffable>> *_Nullable oldArray,
NSArray<id<IGListDiffable>> *_Nullable newArray,
IGListDiffOption option,
IGListExperiment experiments);

/**
Performs a index path diff with an experiment bitmask.
@param fromSection The old section.
@param toSection The new section.
@param oldArray The old array of objects.
@param newArray The new array of objects.
@param option Option to specify the type of diff.
@param experiments Optional experiments.
@return An index path result object containing the changed indexPaths.
@see `IGListDiffPaths()`.
*/
NS_SWIFT_NAME(ListDiffPathsExperiment(fromSection:toSection:oldArray:newArray:option:experiments:))
FOUNDATION_EXTERN IGListIndexPathResult *IGListDiffPathsExperiment(NSInteger fromSection,
NSInteger toSection,
NSArray<id<IGListDiffable>> *_Nullable oldArray,
NSArray<id<IGListDiffable>> *_Nullable newArray,
IGListDiffOption option,
IGListExperiment experiments);

NS_ASSUME_NONNULL_END
8 changes: 3 additions & 5 deletions Source/IGListKit/IGListAdapterUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ - (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)co
result,
self.batchUpdates,
fromObjects,
experiments,
self.sectionMovesAsDeletesInserts,
self.preferItemReloadsForSectionReloads);
}
Expand Down Expand Up @@ -303,7 +302,7 @@ - (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)co

const BOOL onBackgroundThread = IGListExperimentEnabled(experiments, IGListExperimentBackgroundDiffing);
[delegate listAdapterUpdater:self willDiffFromObjects:fromObjects toObjects:toObjects];
IGListAdapterUpdaterPerformDiffing(fromObjects, toObjects, IGListDiffEquality, experiments, onBackgroundThread, ^(IGListIndexSetResult *result){
IGListAdapterUpdaterPerformDiffing(fromObjects, toObjects, IGListDiffEquality, onBackgroundThread, ^(IGListIndexSetResult *result){
[delegate listAdapterUpdater:self didDiffWithResults:result onBackgroundThread:onBackgroundThread];
tryToPerformUpdate(result);
});
Expand Down Expand Up @@ -579,18 +578,17 @@ static void IGListAdapterUpdaterPerformBatchUpdate(UICollectionView *collectionV
static void IGListAdapterUpdaterPerformDiffing(NSArray<id<IGListDiffable>> *_Nullable oldArray,
NSArray<id<IGListDiffable>> *_Nullable newArray,
IGListDiffOption option,
IGListExperiment experiments,
BOOL onBackgroundThread,
IGListAdapterUpdaterDiffResultBlock completion) {
if (onBackgroundThread) {
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
IGListIndexSetResult *result = IGListDiffExperiment(oldArray, newArray, option, experiments);
IGListIndexSetResult *result = IGListDiff(oldArray, newArray, option);
dispatch_async(dispatch_get_main_queue(), ^{
completion(result);
});
});
} else {
IGListIndexSetResult *result = IGListDiffExperiment(oldArray, newArray, option, experiments);
IGListIndexSetResult *result = IGListDiff(oldArray, newArray, option);
completion(result);
}
}
Expand Down
6 changes: 0 additions & 6 deletions Source/IGListKit/IGListCollectionViewLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <UIKit/UIKit.h>

#import <IGListDiffKit/IGListExperiments.h>
#import <IGListDiffKit/IGListMacros.h>

#import "IGListCollectionViewLayoutCompatible.h"
Expand Down Expand Up @@ -94,11 +93,6 @@ NS_SWIFT_NAME(ListCollectionViewLayout)
*/
@property (nonatomic, assign) BOOL showHeaderWhenEmpty;

/**
A bitmask of experiments to conduct on the adapter.
*/
@property (nonatomic, assign) IGListExperiment experiments;

/**
Create and return a new collection view layout.
Expand Down
3 changes: 0 additions & 3 deletions Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#import <UIKit/UIKit.h>

#import <IGListDiffKit/IGListExperiments.h>

@class IGListBatchUpdateData;
@class IGListBatchUpdates;
@class IGListIndexSetResult;
Expand All @@ -26,7 +24,6 @@ IGListBatchUpdateData *IGListApplyUpdatesToCollectionView(UICollectionView *coll
IGListIndexSetResult *diffResult,
IGListBatchUpdates *batchUpdates,
NSArray<id<IGListDiffable>> *fromObjects,
IGListExperiment experiments,
BOOL sectionMovesAsDeletesInserts,
BOOL preferItemReloadsForSectionReloads);

Expand Down
2 changes: 0 additions & 2 deletions Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#import <IGListDiffKit/IGListAssert.h>
#import <IGListDiffKit/IGListBatchUpdateData.h>
#import <IGListDiffKit/IGListDiffable.h>
#import <IGListDiffKit/IGListExperiments.h>
#import <IGListDiffKit/IGListIndexSetResult.h>

#import "IGListBatchUpdates.h"
Expand Down Expand Up @@ -58,7 +57,6 @@ void IGListConvertReloadToDeleteInsert(NSMutableIndexSet *reloads,
IGListIndexSetResult *diffResult,
IGListBatchUpdates *batchUpdates,
NSArray<id<IGListDiffable>> *fromObjects,
IGListExperiment experiments,
BOOL sectionMovesAsDeletesInserts,
BOOL preferItemReloadsForSectionReloads) {
NSSet *moves = [[NSSet alloc] initWithArray:diffResult.moves];
Expand Down
1 change: 0 additions & 1 deletion Tests/IGListDiffTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import <XCTest/XCTest.h>

#import <IGListDiffKit/IGListDiff.h>
#import <IGListDiffKit/IGListExperiments.h>

#import "IGListIndexSetResultInternal.h"
#import "IGListMoveIndexInternal.h"
Expand Down

0 comments on commit 254c041

Please # to comment.