mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Refactor calculation of interface state based on ASDisplayNode and window
This commit is contained in:
@@ -794,17 +794,7 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
|
||||
|
||||
- (ASInterfaceState)interfaceStateForRangeController:(ASRangeController *)rangeController
|
||||
{
|
||||
ASTableNode *tableNode = self.tableNode;
|
||||
if (tableNode && [tableNode supportsRangeManagedInterfaceState]) {
|
||||
// Only use the interfaceState of nodes that are range managed
|
||||
ASInterfaceState interfaceState = self.tableNode.interfaceState;
|
||||
return (self.window == nil ? (interfaceState &= (~ASInterfaceStateVisible)) : interfaceState);
|
||||
} else {
|
||||
// For not range managed nodes or until we can always create an associated ASTableNode
|
||||
// without a retain cycle, we might be on our own to try to guess if we're visible. The node normally
|
||||
// handles this even if it is the root / directly added to the view hierarchy.
|
||||
return (self.window == nil ? ASInterfaceStateNone : (ASInterfaceStateVisible | ASInterfaceStateDisplay));
|
||||
}
|
||||
return ASInterfaceStateForDisplayNode(self.tableNode, self.window);
|
||||
}
|
||||
|
||||
#pragma mark - ASRangeControllerDelegate
|
||||
|
||||
Reference in New Issue
Block a user