mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
One more critical update integrity fix
This commit is contained in:
@@ -17,8 +17,8 @@
|
|||||||
/// Returns all the item indexes from the given index paths that are in the given section.
|
/// Returns all the item indexes from the given index paths that are in the given section.
|
||||||
+ (NSIndexSet *)as_indexSetFromIndexPaths:(NSArray<NSIndexPath *> *)indexPaths inSection:(NSUInteger)section;
|
+ (NSIndexSet *)as_indexSetFromIndexPaths:(NSArray<NSIndexPath *> *)indexPaths inSection:(NSUInteger)section;
|
||||||
|
|
||||||
/// If you've got an old index, and you insert items using this index set, this returns the new index.
|
/// If you've got an old index, and you insert items using this index set, this returns the change to get to the new index.
|
||||||
- (NSUInteger)as_indexByInsertingItemsBelowIndex:(NSUInteger)index;
|
- (NSUInteger)as_indexChangeByInsertingItemsBelowIndex:(NSUInteger)index;
|
||||||
|
|
||||||
- (NSString *)as_smallDescription;
|
- (NSString *)as_smallDescription;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSUInteger)as_indexByInsertingItemsBelowIndex:(NSUInteger)index
|
- (NSUInteger)as_indexChangeByInsertingItemsBelowIndex:(NSUInteger)index
|
||||||
{
|
{
|
||||||
__block NSUInteger newIndex = index;
|
__block NSUInteger newIndex = index;
|
||||||
[self enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
|
[self enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
*stop = YES;
|
*stop = YES;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
return newIndex;
|
return newIndex - index;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)as_smallDescription
|
- (NSString *)as_smallDescription
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSUInteger newIndex = oldSection - [_deletedSections countOfIndexesInRange:NSMakeRange(0, oldSection)];
|
NSUInteger newIndex = oldSection - [_deletedSections countOfIndexesInRange:NSMakeRange(0, oldSection)];
|
||||||
newIndex = [_insertedSections as_indexByInsertingItemsBelowIndex:newIndex];
|
newIndex += [_insertedSections as_indexChangeByInsertingItemsBelowIndex:newIndex];
|
||||||
return newIndex;
|
return newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ NSString *NSStringFromASHierarchyChangeType(_ASHierarchyChangeType changeType)
|
|||||||
item -= [indicesDeletedInSection countOfIndexesInRange:NSMakeRange(0, item)];
|
item -= [indicesDeletedInSection countOfIndexesInRange:NSMakeRange(0, item)];
|
||||||
// Update row number based on insertions that are above the current row in the future section
|
// Update row number based on insertions that are above the current row in the future section
|
||||||
NSIndexSet *indicesInsertedInSection = insertedIndexPathsMap[@(section)];
|
NSIndexSet *indicesInsertedInSection = insertedIndexPathsMap[@(section)];
|
||||||
item = [indicesInsertedInSection as_indexByInsertingItemsBelowIndex:item];
|
item += [indicesInsertedInSection as_indexChangeByInsertingItemsBelowIndex:item];
|
||||||
|
|
||||||
//TODO: reuse the old indexPath object if section and row aren't changed
|
//TODO: reuse the old indexPath object if section and row aren't changed
|
||||||
NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:item inSection:section];
|
NSIndexPath *newIndexPath = [NSIndexPath indexPathForItem:item inSection:section];
|
||||||
|
|||||||
Reference in New Issue
Block a user