mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[ASRangeController] Ensure that visibilityDidChange: is always called on app launch for all initial cells.
This commit is contained in:
@@ -91,7 +91,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
||||
_scrollDirection = scrollDirection;
|
||||
|
||||
// Perform update immediately, so that cells receive a visibilityDidChange: call before their first pixel is visible.
|
||||
[self performRangeUpdate];
|
||||
[self scheduleRangeUpdate];
|
||||
}
|
||||
|
||||
- (void)updateCurrentRangeWithMode:(ASLayoutRangeMode)rangeMode
|
||||
@@ -153,14 +153,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
||||
// allNodes is a 2D array: it contains arrays for each section, each containing nodes.
|
||||
NSArray<NSArray *> *allNodes = [_dataSource completedNodes];
|
||||
NSUInteger numberOfSections = [allNodes count];
|
||||
|
||||
if (_allPreviousIndexPaths.count == 0 && allNodes.count == 0) {
|
||||
// In certain cases, such as on app suspend, an update may be triggered before we've loaded anything.
|
||||
// For example, an ASCollectionNode inside another scrollable area will not load content until it has entered
|
||||
// the display range, but the object may have been allocated by a cell and added to the set of active range controllers.
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Consider if we need to use this codepath, or can rely on something more similar to the data & display ranges
|
||||
// Example: ... = [_layoutController indexPathsForScrolling:_scrollDirection rangeType:ASLayoutRangeTypeVisible];
|
||||
NSArray<NSIndexPath *> *visibleNodePaths = [_dataSource visibleNodeIndexPathsForRangeController:self];
|
||||
|
||||
Reference in New Issue
Block a user