mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
[ASRangeController] Ensure that even if the collection view layout is inconsistent, it is impossible for a visible item to not be in the display range.
This commit is contained in:
@@ -120,11 +120,6 @@ typedef NS_OPTIONS(NSUInteger, ASControlState) {
|
|||||||
*/
|
*/
|
||||||
- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event;
|
- (void)sendActionsForControlEvents:(ASControlNodeEvent)controlEvents withEvent:(nullable UIEvent *)event;
|
||||||
|
|
||||||
/**
|
|
||||||
Class method to enable a visualization overlay of the tapable area on the ASControlNode. For app debugging purposes only.
|
|
||||||
@param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class.
|
|
||||||
*/
|
|
||||||
+ (void)setEnableHitTestDebug:(BOOL)enable;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -2003,6 +2003,8 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
|
|||||||
|
|
||||||
- (void)setInterfaceState:(ASInterfaceState)newState
|
- (void)setInterfaceState:(ASInterfaceState)newState
|
||||||
{
|
{
|
||||||
|
// It should never be possible for a node to be visible but not be allowed / expected to display.
|
||||||
|
ASDisplayNodeAssertFalse(ASInterfaceStateIncludesVisible(newState) && !ASInterfaceStateIncludesDisplay(newState));
|
||||||
ASInterfaceState oldState = ASInterfaceStateNone;
|
ASInterfaceState oldState = ASInterfaceStateNone;
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
|
|||||||
@@ -6,9 +6,19 @@
|
|||||||
// Copyright © 2016 Facebook. All rights reserved.
|
// Copyright © 2016 Facebook. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import "ASControlNode.h"
|
||||||
#import "ASImageNode.h"
|
#import "ASImageNode.h"
|
||||||
|
|
||||||
|
@interface ASControlNode (Debugging)
|
||||||
|
|
||||||
|
/**
|
||||||
|
Class method to enable a visualization overlay of the tapable area on the ASControlNode. For app debugging purposes only.
|
||||||
|
@param enable Specify YES to make this debug feature enabled when messaging the ASControlNode class.
|
||||||
|
*/
|
||||||
|
+ (void)setEnableHitTestDebug:(BOOL)enable;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
@interface ASImageNode (Debugging)
|
@interface ASImageNode (Debugging)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
|||||||
[self registerForNotificationsForInterfaceStateIfNeeded:selfInterfaceState];
|
[self registerForNotificationsForInterfaceStateIfNeeded:selfInterfaceState];
|
||||||
|
|
||||||
#if ASRangeControllerLoggingEnabled
|
#if ASRangeControllerLoggingEnabled
|
||||||
|
ASDisplayNodeAssertTrue([visibleIndexPaths isSubsetOfSet:displayIndexPaths]);
|
||||||
NSMutableArray<NSIndexPath *> *modifiedIndexPaths = (ASRangeControllerLoggingEnabled ? [NSMutableArray array] : nil);
|
NSMutableArray<NSIndexPath *> *modifiedIndexPaths = (ASRangeControllerLoggingEnabled ? [NSMutableArray array] : nil);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -247,14 +248,15 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
|
|||||||
ASInterfaceState interfaceState = ASInterfaceStateMeasureLayout;
|
ASInterfaceState interfaceState = ASInterfaceStateMeasureLayout;
|
||||||
|
|
||||||
if (ASInterfaceStateIncludesVisible(selfInterfaceState)) {
|
if (ASInterfaceStateIncludesVisible(selfInterfaceState)) {
|
||||||
|
if ([visibleIndexPaths containsObject:indexPath]) {
|
||||||
|
interfaceState |= (ASInterfaceStateVisible | ASInterfaceStateDisplay | ASInterfaceStateFetchData);
|
||||||
|
} else {
|
||||||
if ([fetchDataIndexPaths containsObject:indexPath]) {
|
if ([fetchDataIndexPaths containsObject:indexPath]) {
|
||||||
interfaceState |= ASInterfaceStateFetchData;
|
interfaceState |= ASInterfaceStateFetchData;
|
||||||
}
|
}
|
||||||
if ([displayIndexPaths containsObject:indexPath]) {
|
if ([displayIndexPaths containsObject:indexPath]) {
|
||||||
interfaceState |= ASInterfaceStateDisplay;
|
interfaceState |= ASInterfaceStateDisplay;
|
||||||
}
|
}
|
||||||
if ([visibleIndexPaths containsObject:indexPath]) {
|
|
||||||
interfaceState |= ASInterfaceStateVisible;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If selfInterfaceState isn't visible, then visibleIndexPaths represents what /will/ be immediately visible at the
|
// If selfInterfaceState isn't visible, then visibleIndexPaths represents what /will/ be immediately visible at the
|
||||||
|
|||||||
Reference in New Issue
Block a user