mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Improvements for automatic range mode
- Only update range mode if visibility changes if the node is not range controlled - Only change explicitly set range mode if ASRangeController becomes visible - Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
This commit is contained in:
@@ -189,7 +189,9 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
||||
|
||||
ASInterfaceState selfInterfaceState = [self interfaceState];
|
||||
ASLayoutRangeMode rangeMode = _currentRangeMode;
|
||||
if (!_didUpdateCurrentRange) {
|
||||
// If the range mode is explicitly set via updateCurrentRangeWithMode: it will last in that mode until the
|
||||
// range controller becomes visible again or explicitly changes the range mode again
|
||||
if (!_didUpdateCurrentRange || ASInterfaceStateIncludesVisible(selfInterfaceState)) {
|
||||
rangeMode = [ASRangeController rangeModeForInterfaceState:selfInterfaceState currentRangeMode:_currentRangeMode];
|
||||
}
|
||||
|
||||
@@ -232,7 +234,10 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
||||
_allPreviousIndexPaths = allCurrentIndexPaths;
|
||||
|
||||
_currentRangeMode = rangeMode;
|
||||
_didUpdateCurrentRange = NO;
|
||||
// Reset the current range mode only if the range controller comes visible
|
||||
if (ASInterfaceStateIncludesVisible(selfInterfaceState)) {
|
||||
_didUpdateCurrentRange = NO;
|
||||
}
|
||||
|
||||
if (!_rangeIsValid) {
|
||||
[allIndexPaths addObjectsFromArray:ASIndexPathsForTwoDimensionalArray(allNodes)];
|
||||
|
||||
Reference in New Issue
Block a user