From 254c04196a6b906a155d8a1dd670c720500bed6c Mon Sep 17 00:00:00 2001 From: Maxime Ollivier Date: Tue, 8 Sep 2020 09:06:16 -0700 Subject: [PATCH] remove unused experiment param 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 --- CHANGELOG.md | 1 + Source/IGListDiffKit/IGListDiff.mm | 24 ++--------- Source/IGListDiffKit/IGListExperiments.h | 40 ------------------- Source/IGListKit/IGListAdapterUpdater.m | 8 ++-- Source/IGListKit/IGListCollectionViewLayout.h | 6 --- .../Internal/IGListAdapterUpdaterHelpers.h | 3 -- .../Internal/IGListAdapterUpdaterHelpers.m | 2 - Tests/IGListDiffTests.m | 1 - 8 files changed, 7 insertions(+), 78 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f2eaa01e..5b3068297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Source/IGListDiffKit/IGListDiff.mm b/Source/IGListDiffKit/IGListDiff.mm index e4f076f1c..f9c21fde6 100644 --- a/Source/IGListDiffKit/IGListDiff.mm +++ b/Source/IGListDiffKit/IGListDiff.mm @@ -12,7 +12,6 @@ #import #import -#import #import "IGListIndexPathResultInternal.h" #import "IGListIndexSetResultInternal.h" @@ -96,8 +95,7 @@ static id IGListDiffing(BOOL returnIndexPaths, NSInteger toSection, NSArray> *oldArray, NSArray> *newArray, - IGListDiffOption option, - IGListExperiment experiments) { + IGListDiffOption option) { const NSInteger newCount = newArray.count; const NSInteger oldCount = oldArray.count; @@ -320,7 +318,7 @@ static id IGListDiffing(BOOL returnIndexPaths, IGListIndexSetResult *IGListDiff(NSArray > *oldArray, NSArray> *newArray, IGListDiffOption option) { - return IGListDiffing(NO, 0, 0, oldArray, newArray, option, 0); + return IGListDiffing(NO, 0, 0, oldArray, newArray, option); } IGListIndexPathResult *IGListDiffPaths(NSInteger fromSection, @@ -328,21 +326,5 @@ static id IGListDiffing(BOOL returnIndexPaths, NSArray> *oldArray, NSArray> *newArray, IGListDiffOption option) { - return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, 0); -} - -IGListIndexSetResult *IGListDiffExperiment(NSArray> *_Nullable oldArray, - NSArray> *_Nullable newArray, - IGListDiffOption option, - IGListExperiment experiments) { - return IGListDiffing(NO, 0, 0, oldArray, newArray, option, experiments); -} - -IGListIndexPathResult *IGListDiffPathsExperiment(NSInteger fromSection, - NSInteger toSection, - NSArray> *_Nullable oldArray, - NSArray> *_Nullable newArray, - IGListDiffOption option, - IGListExperiment experiments) { - return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option, experiments); + return IGListDiffing(YES, fromSection, toSection, oldArray, newArray, option); } diff --git a/Source/IGListDiffKit/IGListExperiments.h b/Source/IGListDiffKit/IGListExperiments.h index af7ab0578..5c3cfd952 100644 --- a/Source/IGListDiffKit/IGListExperiments.h +++ b/Source/IGListDiffKit/IGListExperiments.h @@ -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> *_Nullable oldArray, - NSArray> *_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> *_Nullable oldArray, - NSArray> *_Nullable newArray, - IGListDiffOption option, - IGListExperiment experiments); - NS_ASSUME_NONNULL_END diff --git a/Source/IGListKit/IGListAdapterUpdater.m b/Source/IGListKit/IGListAdapterUpdater.m index 5e8d46cc9..f8a095154 100644 --- a/Source/IGListKit/IGListAdapterUpdater.m +++ b/Source/IGListKit/IGListAdapterUpdater.m @@ -226,7 +226,6 @@ - (void)performBatchUpdatesWithCollectionViewBlock:(IGListCollectionViewBlock)co result, self.batchUpdates, fromObjects, - experiments, self.sectionMovesAsDeletesInserts, self.preferItemReloadsForSectionReloads); } @@ -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); }); @@ -579,18 +578,17 @@ static void IGListAdapterUpdaterPerformBatchUpdate(UICollectionView *collectionV static void IGListAdapterUpdaterPerformDiffing(NSArray> *_Nullable oldArray, NSArray> *_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); } } diff --git a/Source/IGListKit/IGListCollectionViewLayout.h b/Source/IGListKit/IGListCollectionViewLayout.h index 781882fb2..f59bec1c7 100644 --- a/Source/IGListKit/IGListCollectionViewLayout.h +++ b/Source/IGListKit/IGListCollectionViewLayout.h @@ -7,7 +7,6 @@ #import -#import #import #import "IGListCollectionViewLayoutCompatible.h" @@ -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. diff --git a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h index 40d0b5e00..f1ef9964c 100644 --- a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h +++ b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h @@ -7,8 +7,6 @@ #import -#import - @class IGListBatchUpdateData; @class IGListBatchUpdates; @class IGListIndexSetResult; @@ -26,7 +24,6 @@ IGListBatchUpdateData *IGListApplyUpdatesToCollectionView(UICollectionView *coll IGListIndexSetResult *diffResult, IGListBatchUpdates *batchUpdates, NSArray> *fromObjects, - IGListExperiment experiments, BOOL sectionMovesAsDeletesInserts, BOOL preferItemReloadsForSectionReloads); diff --git a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m index dbeb72b7a..ef1bb6653 100644 --- a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m +++ b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m @@ -10,7 +10,6 @@ #import #import #import -#import #import #import "IGListBatchUpdates.h" @@ -58,7 +57,6 @@ void IGListConvertReloadToDeleteInsert(NSMutableIndexSet *reloads, IGListIndexSetResult *diffResult, IGListBatchUpdates *batchUpdates, NSArray> *fromObjects, - IGListExperiment experiments, BOOL sectionMovesAsDeletesInserts, BOOL preferItemReloadsForSectionReloads) { NSSet *moves = [[NSSet alloc] initWithArray:diffResult.moves]; diff --git a/Tests/IGListDiffTests.m b/Tests/IGListDiffTests.m index d9071cd0c..bb2587cd6 100644 --- a/Tests/IGListDiffTests.m +++ b/Tests/IGListDiffTests.m @@ -11,7 +11,6 @@ #import #import -#import #import "IGListIndexSetResultInternal.h" #import "IGListMoveIndexInternal.h"