diff --git a/Source/IGListDiffKit/IGListBatchUpdateData.h b/Source/IGListDiffKit/IGListBatchUpdateData.h index 226c1baf6..ba6bfc048 100644 --- a/Source/IGListDiffKit/IGListBatchUpdateData.h +++ b/Source/IGListDiffKit/IGListBatchUpdateData.h @@ -67,7 +67,7 @@ NS_SWIFT_NAME(ListBatchUpdateData) @param deleteIndexPaths Item index paths to delete. @param updateIndexPaths Item index paths to update. @param moveIndexPaths Item index paths to move. - @param enableNetItemCountFix Fix item count balance issue when removing duplicate deletes + @return A new batch update object. */ @@ -77,8 +77,7 @@ NS_SWIFT_NAME(ListBatchUpdateData) insertIndexPaths:(NSArray *)insertIndexPaths deleteIndexPaths:(NSArray *)deleteIndexPaths updateIndexPaths:(NSArray *)updateIndexPaths - moveIndexPaths:(NSArray *)moveIndexPaths - enableNetItemCountFix:(BOOL)enableNetItemCountFix NS_DESIGNATED_INITIALIZER; + moveIndexPaths:(NSArray *)moveIndexPaths NS_DESIGNATED_INITIALIZER; /** :nodoc: diff --git a/Source/IGListDiffKit/IGListBatchUpdateData.mm b/Source/IGListDiffKit/IGListBatchUpdateData.mm index 7364e44bd..006fb3865 100644 --- a/Source/IGListDiffKit/IGListBatchUpdateData.mm +++ b/Source/IGListDiffKit/IGListBatchUpdateData.mm @@ -61,8 +61,7 @@ - (instancetype)initWithInsertSections:(nonnull NSIndexSet *)insertSections insertIndexPaths:(nonnull NSArray *)insertIndexPaths deleteIndexPaths:(nonnull NSArray *)deleteIndexPaths updateIndexPaths:(nonnull NSArray *)updateIndexPaths - moveIndexPaths:(nonnull NSArray *)moveIndexPaths - enableNetItemCountFix:(BOOL)enableNetItemCountFix { + moveIndexPaths:(nonnull NSArray *)moveIndexPaths { IGParameterAssert(insertSections != nil); IGParameterAssert(deleteSections != nil); IGParameterAssert(moveSections != nil); @@ -96,41 +95,37 @@ - (instancetype)initWithInsertSections:(nonnull NSIndexSet *)insertSections toMap[to] = move; } } - + NSMutableArray *mDeleteIndexPaths; NSMutableArray *mInsertIndexPaths; // Avoid a flaky UICollectionView bug when deleting from the same index path twice // exposes a possible data source inconsistency issue - if (enableNetItemCountFix) { - NSMutableDictionary *const deleteCounts = [NSMutableDictionary new]; - - // If we need to remove a duplicate delete, we also need to remove an insert to balance the count. - // Lets build the delete counts for each index, which we can use to skip corresponding inserts. - for (NSIndexPath *deleteIndexPath in deleteIndexPaths) { - const NSInteger deleteCount = deleteCounts[deleteIndexPath].integerValue; - deleteCounts[deleteIndexPath] = @(deleteCount + 1); - } + NSMutableDictionary *const deleteCounts = [NSMutableDictionary new]; - // Skip inserts that have an associated skipped delete - NSMutableArray *const trimmedInsertIndexPath = [NSMutableArray new]; - for (NSIndexPath *insertIndexPath in insertIndexPaths) { - const NSInteger deleteCount = deleteCounts[insertIndexPath].integerValue; - if (deleteCount > 1) { - // Skip! - deleteCounts[insertIndexPath] = @(deleteCount - 1); - } else { - [trimmedInsertIndexPath addObject:insertIndexPath]; - } - } + // If we need to remove a duplicate delete, we also need to remove an insert to balance the count. + // Lets build the delete counts for each index, which we can use to skip corresponding inserts. + for (NSIndexPath *deleteIndexPath in deleteIndexPaths) { + const NSInteger deleteCount = deleteCounts[deleteIndexPath].integerValue; + deleteCounts[deleteIndexPath] = @(deleteCount + 1); + } - mDeleteIndexPaths = [[deleteCounts allKeys] mutableCopy]; - mInsertIndexPaths = trimmedInsertIndexPath; - } else { - mDeleteIndexPaths = [[[NSSet setWithArray:deleteIndexPaths] allObjects] mutableCopy]; - mInsertIndexPaths = [insertIndexPaths mutableCopy]; + // Skip inserts that have an associated skipped delete + NSMutableArray *const trimmedInsertIndexPath = [NSMutableArray new]; + for (NSIndexPath *insertIndexPath in insertIndexPaths) { + const NSInteger deleteCount = deleteCounts[insertIndexPath].integerValue; + if (deleteCount > 1) { + // Skip! + deleteCounts[insertIndexPath] = @(deleteCount - 1); + } else { + [trimmedInsertIndexPath addObject:insertIndexPath]; + } } + mDeleteIndexPaths = [[deleteCounts allKeys] mutableCopy]; + mInsertIndexPaths = trimmedInsertIndexPath; + + // avoids a bug where a cell is animated twice and one of the snapshot cells is never removed from the hierarchy [IGListBatchUpdateData _cleanIndexPathsWithMap:fromMap moves:mMoveSections indexPaths:mDeleteIndexPaths deletes:mDeleteSections inserts:mInsertSections]; diff --git a/Source/IGListDiffKit/IGListExperiments.h b/Source/IGListDiffKit/IGListExperiments.h index cb72bc7ff..d2c3d9b90 100644 --- a/Source/IGListDiffKit/IGListExperiments.h +++ b/Source/IGListDiffKit/IGListExperiments.h @@ -22,8 +22,6 @@ typedef NS_OPTIONS (NSInteger, IGListExperiment) { IGListExperimentThrowOnInconsistencyException = 1 << 3, /// Remove the early exit so multiple updates can't happen at once IGListExperimentRemoveDataSourceChangeEarlyExit = 1 << 4, - /// Fix item count balance issue when removing duplicate deletes - IGListExperimentEnableNetItemCountFix = 1 << 5, }; /** diff --git a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h index b0414db5a..7766714ea 100644 --- a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h +++ b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.h @@ -30,8 +30,7 @@ IGListBatchUpdateData *IGListApplyUpdatesToCollectionView(UICollectionView *coll NSMutableArray *itemMoves, NSArray> *fromObjects, BOOL sectionMovesAsDeletesInserts, - BOOL preferItemReloadsForSectionReloads, - BOOL enableNetItemCountFix); + BOOL preferItemReloadsForSectionReloads); NSIndexSet *IGListSectionIndexFromIndexPaths(NSArray *indexPaths); diff --git a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m index 5a3f4567f..b36bb53b6 100644 --- a/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m +++ b/Source/IGListKit/Internal/IGListAdapterUpdaterHelpers.m @@ -68,8 +68,7 @@ void IGListConvertReloadToDeleteInsert(NSMutableIndexSet *reloads, NSMutableArray *itemMoves, NSArray> *fromObjects, BOOL sectionMovesAsDeletesInserts, - BOOL preferItemReloadsForSectionReloads, - BOOL enableNetItemCountFix) { + BOOL preferItemReloadsForSectionReloads) { NSSet *moves = [[NSSet alloc] initWithArray:diffResult.moves]; // combine section reloads from the diff and manual reloads via reloadItems: @@ -126,8 +125,7 @@ void IGListConvertReloadToDeleteInsert(NSMutableIndexSet *reloads, insertIndexPaths:itemInserts deleteIndexPaths:itemDeletes updateIndexPaths:itemUpdates - moveIndexPaths:itemMoves - enableNetItemCountFix:enableNetItemCountFix]; + moveIndexPaths:itemMoves]; [collectionView ig_applyBatchUpdateData:updateData]; return updateData; } diff --git a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m index 82f4dba7c..d81083292 100644 --- a/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m +++ b/Source/IGListKit/Internal/IGListBatchUpdateTransaction.m @@ -241,7 +241,6 @@ - (void)_applyDataUpdates { } - (void)_applyCollectioViewUpdates:(IGListIndexSetResult *)diffResult { - const BOOL enableNetItemCountFix = IGListExperimentEnabled(self.config.experiments, IGListExperimentEnableNetItemCountFix); if (self.config.singleItemSectionUpdates) { [self.collectionView deleteSections:diffResult.deletes]; [self.collectionView insertSections:diffResult.inserts]; @@ -257,8 +256,7 @@ - (void)_applyCollectioViewUpdates:(IGListIndexSetResult *)diffResult { insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:enableNetItemCountFix]; + moveIndexPaths:@[]]; } else { self.actualCollectionViewUpdates = IGListApplyUpdatesToCollectionView(self.collectionView, diffResult, @@ -269,8 +267,7 @@ - (void)_applyCollectioViewUpdates:(IGListIndexSetResult *)diffResult { self.inUpdateItemCollector.itemMoves, self.sectionData.fromObjects ?: @[], self.config.sectionMovesAsDeletesInserts, - self.config.preferItemReloadsForSectionReloads, - enableNetItemCountFix); + self.config.preferItemReloadsForSectionReloads); } } diff --git a/Tests/IGListAdapterUpdaterTests.m b/Tests/IGListAdapterUpdaterTests.m index d41e2e58b..c15b3c09a 100644 --- a/Tests/IGListAdapterUpdaterTests.m +++ b/Tests/IGListAdapterUpdaterTests.m @@ -779,8 +779,7 @@ - (void)test_whenReloadIsCalledWithSameItemCount_deleteInsertSectionHappen { insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id"]]; NSArray *to = @[[IGSectionObject sectionWithObjects:@[@2] identifier:@"id"]]; self.dataSource.sections = from; @@ -997,8 +996,7 @@ - (void)test_whenReloadIsCalledWithSameItemCount_andPreferItemReload_updateIndex insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:0]] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id"]]; // Update the items NSArray *to = @[[IGSectionObject sectionWithObjects:@[@2] identifier:@"id"]]; @@ -1033,8 +1031,7 @@ - (void)test_whenReloadIsCalledWithDifferentItemCount_andPreferItemReload_delete insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id"]]; // more items in the section NSArray *to = @[[IGSectionObject sectionWithObjects:@[@1, @2] identifier:@"id"]]; @@ -1070,8 +1067,7 @@ - (void)test_whenReloadIsCalledWithSectionMoveAndUpdate_andPreferItemReload_dele insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id1"], [IGSectionObject sectionWithObjects:@[@2] identifier:@"id2"]]; // move section, and also update the item for "id2" @@ -1113,8 +1109,7 @@ - (void)test_whenReloadIsCalledWithSectionMoveAndUpdate_withDifferentSectionLeng insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1, @2, @3] identifier:@"id1"], [IGSectionObject sectionWithObjects:@[@2] identifier:@"id2"]]; // move section, and also update the item for "id2" @@ -1157,8 +1152,7 @@ - (void)test_whenReloadIsCalledWithSectionMoveAndUpdate_withThreeSections_delete insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id1"], [IGSectionObject sectionWithObjects:@[@2] identifier:@"id2"], [IGSectionObject sectionWithObjects:@[@3] identifier:@"id3"]]; @@ -1201,8 +1195,7 @@ - (void)test_whenReloadIsCalledWithSectionInsertAndUpdate_andPreferItemReload_no insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; NSArray *from = @[[IGSectionObject sectionWithObjects:@[@1] identifier:@"id1"]]; NSArray *to = @[[IGSectionObject sectionWithObjects:@[@2] identifier:@"id1"], [IGSectionObject sectionWithObjects:@[@22] identifier:@"id2"]]; diff --git a/Tests/IGListBatchUpdateDataTests.m b/Tests/IGListBatchUpdateDataTests.m index 7b0633982..3bc82f730 100644 --- a/Tests/IGListBatchUpdateDataTests.m +++ b/Tests/IGListBatchUpdateDataTests.m @@ -49,8 +49,7 @@ - (void)test_whenEmptyUpdates_thatResultExists { insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertNotNil(result); } @@ -61,8 +60,7 @@ - (void)test_whenUpdatesAreClean_thatResultMatches { insertIndexPaths:@[newPath(0, 0)] deleteIndexPaths:@[newPath(1, 0)] updateIndexPaths:@[] - moveIndexPaths:@[newMovePath(6, 0, 6, 1)] - enableNetItemCountFix:NO]; + moveIndexPaths:@[newMovePath(6, 0, 6, 1)]]; XCTAssertEqualObjects(result.insertSections, indexSet(@[@0, @1])); XCTAssertEqualObjects(result.deleteSections, indexSet(@[@5])); XCTAssertEqualObjects(result.moveSections, [NSSet setWithArray:@[newMove(3, 4)]]); @@ -79,8 +77,7 @@ - (void)test_whenMovingSections_withItemDeletes_thatResultConvertsConflicts_toDe insertIndexPaths:@[] deleteIndexPaths:@[newPath(2, 0), newPath(3, 4)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertEqualObjects(result.insertSections, indexSet(@[@4])); XCTAssertEqualObjects(result.deleteSections, indexSet(@[@2])); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(3, 4)]); @@ -94,8 +91,7 @@ - (void)test_whenMovingSections_withItemInserts_thatResultConvertsConflicts_toDe insertIndexPaths:@[newPath(4, 0), newPath(3, 4)] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertEqualObjects(result.insertSections, indexSet(@[@4])); XCTAssertEqualObjects(result.deleteSections, indexSet(@[@2])); XCTAssertEqualObjects(result.insertIndexPaths, @[newPath(3, 4)]); @@ -109,8 +105,7 @@ - (void)test_whenMovingIndexPaths_withSectionDeleted_thatResultDropsTheMove { insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[newMovePath(0, 0, 0, 1)] - enableNetItemCountFix:NO]; + moveIndexPaths:@[newMovePath(0, 0, 0, 1)]]; XCTAssertEqual(result.moveIndexPaths.count, 0); XCTAssertEqualObjects(result.deleteSections, indexSet(@[@0])); } @@ -122,8 +117,7 @@ - (void)test_whenMovingIndexPaths_withSectionMoved_thatResultConvertsToDeletesAn insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[newMovePath(0, 0, 0, 1)] - enableNetItemCountFix:NO]; + moveIndexPaths:@[newMovePath(0, 0, 0, 1)]]; XCTAssertEqual(result.moveIndexPaths.count, 0); XCTAssertEqual(result.moveSections.count, 0); XCTAssertEqualObjects(result.deleteSections, indexSet(@[@0])); @@ -137,8 +131,7 @@ - (void)test_whenMovingSections_withMoveFromConflictWithDelete_thatResultDropsTh insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertEqual(result.deleteSections.count, 1); XCTAssertEqual(result.moveSections.count, 1); XCTAssertEqual(result.insertSections.count, 0); @@ -153,64 +146,59 @@ - (void)test_whenDeletingSameIndexPathMultipleTimes_thatResultDropsTheDuplicates insertIndexPaths:@[] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenNoInsertingAndDeletingTwice_withNetItemCountFix_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { +- (void)test_whenNoInsertingAndDeletingTwice_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; XCTAssertEqualObjects(result.insertIndexPaths, @[]); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenInsertingOnceAndDeletingTwice_withNetItemCountFix_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { +- (void)test_whenInsertingOnceAndDeletingTwice_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[newPath(2, 0)] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; // Should remove one insert XCTAssertEqualObjects(result.insertIndexPaths, @[]); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenInsertingTwiceAndDeletingTwice_withNetItemCountFix_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { +- (void)test_whenInsertingTwiceAndDeletingTwice_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[newPath(2, 0), newPath(2, 0)] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; // Should remove one insert XCTAssertEqualObjects(result.insertIndexPaths, @[newPath(2, 0)]); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenInsertingThriceAndDeletingTwice_withNetItemCountFix_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { +- (void)test_whenInsertingThriceAndDeletingTwice_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[newPath(2, 0), newPath(2, 0), newPath(2, 0)] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; // Should remove one insert NSArray *const expectedInsertIndexPaths = @[newPath(2, 0), newPath(2, 0)]; @@ -218,30 +206,28 @@ - (void)test_whenInsertingThriceAndDeletingTwice_withNetItemCountFix_thatResultD XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenInsertingThriceAndDeletingThrice_withNetItemCountFix_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { +- (void)test_whenInsertingThriceAndDeletingThrice_thatResultDropsTheDuplicatesWithKeepsSameNetItemCount { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[newPath(2, 0), newPath(2, 0), newPath(2, 0)] deleteIndexPaths:@[newPath(2, 0), newPath(2, 0), newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; // Should remove 2 inserts XCTAssertEqualObjects(result.insertIndexPaths, @[newPath(2, 0)]); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); } -- (void)test_whenInsertingOnceAndDeletingOnce_withNetItemCountFix_thatNoThingChanges { +- (void)test_whenInsertingOnceAndDeletingOnce_thatNoThingChanges { IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[]) deleteSections:indexSet(@[]) moveSections:[NSSet new] insertIndexPaths:@[newPath(2, 0)] deleteIndexPaths:@[newPath(2, 0)] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:YES]; + moveIndexPaths:@[]]; XCTAssertEqualObjects(result.insertIndexPaths, @[newPath(2, 0)]); XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]); @@ -254,8 +240,7 @@ - (void)test_whenUpdatesAreClean_thatObjectIsEqualToItself { insertIndexPaths:@[newPath(0, 0)] deleteIndexPaths:@[newPath(1, 0)] updateIndexPaths:@[] - moveIndexPaths:@[newMovePath(6, 0, 6, 1)] - enableNetItemCountFix:NO]; + moveIndexPaths:@[newMovePath(6, 0, 6, 1)]]; XCTAssertTrue([result isEqual:result]); } @@ -266,8 +251,7 @@ - (void)test_whenEmptyUpdates_thatResultDoesNotEqualOtherClasses { insertIndexPaths:@[] deleteIndexPaths:@[] updateIndexPaths:@[] - moveIndexPaths:@[] - enableNetItemCountFix:NO]; + moveIndexPaths:@[]]; XCTAssertFalse([emptyResult isEqual:[NSObject new]]); } diff --git a/Tests/IGListDebugDescriptionTests.m b/Tests/IGListDebugDescriptionTests.m index 9ec55090b..bcdefdf0f 100644 --- a/Tests/IGListDebugDescriptionTests.m +++ b/Tests/IGListDebugDescriptionTests.m @@ -103,11 +103,9 @@ - (void)test_withBatchUpdateData_thatDebugDescriptionIsValid { insertIndexPaths:@[insertIndexPaths] deleteIndexPaths:@[deleteIndexPaths] updateIndexPaths:@[] - moveIndexPaths:@[moveIndexPaths] - enableNetItemCountFix:NO]; + moveIndexPaths:@[moveIndexPaths]]; XCTAssertTrue(data.debugDescriptionLines.count > 0); } @end - diff --git a/Tests/IGListDiffDescriptionStringTests.m b/Tests/IGListDiffDescriptionStringTests.m index 2c1c1f5d0..7ece6f100 100644 --- a/Tests/IGListDiffDescriptionStringTests.m +++ b/Tests/IGListDiffDescriptionStringTests.m @@ -25,22 +25,21 @@ - (void)test_withBatchUpdateData_thatDescriptionStringIsValid { NSMutableIndexSet *insertSections = [NSMutableIndexSet indexSet]; [insertSections addIndex:0]; [insertSections addIndex:1]; - + NSIndexSet *deleteSections = [NSIndexSet indexSetWithIndex:5]; IGListMoveIndex *moveSections = [[IGListMoveIndex alloc] initWithFrom:3 to:4]; NSIndexPath *insertIndexPaths = [NSIndexPath indexPathForItem:0 inSection:0]; NSIndexPath *deleteIndexPaths = [NSIndexPath indexPathForItem:0 inSection:0]; IGListMoveIndexPath *moveIndexPaths = [[IGListMoveIndexPath alloc] initWithFrom:[NSIndexPath indexPathForItem:0 inSection:6] to:[NSIndexPath indexPathForItem:1 inSection:6]]; - + IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:insertSections deleteSections:deleteSections moveSections:[NSSet setWithObject:moveSections] insertIndexPaths:@[insertIndexPaths] deleteIndexPaths:@[deleteIndexPaths] updateIndexPaths:@[] - moveIndexPaths:@[moveIndexPaths] - enableNetItemCountFix:NO]; + moveIndexPaths:@[moveIndexPaths]]; NSString *expectedDescription = [NSString stringWithFormat:@"