mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Placeholder implementation of -setInterfaceState:.
This commit is contained in:
@@ -46,7 +46,7 @@ typedef NS_OPTIONS(NSUInteger, ASInterfaceState)
|
||||
ASInterfaceStateMeasureLayout = 1 << 1,
|
||||
/** The element is likely enough to come onscreen that disk and/or network data required for display should be fetched. */
|
||||
ASInterfaceStateFetchData = 1 << 2,
|
||||
/** The elemant is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */
|
||||
/** The element is very likely to become visible, and concurrent rendering should be executed for any -setNeedsDisplay. */
|
||||
ASInterfaceStateDisplay = 1 << 3,
|
||||
/** The element is physically onscreen by at least 1 pixel.
|
||||
In practice, all other bit fields should also be set when this flag is set. */
|
||||
|
||||
@@ -1692,6 +1692,39 @@ void recursivelyEnsureDisplayForLayer(CALayer *layer)
|
||||
- (void)setInterfaceState:(ASInterfaceState)interfaceState
|
||||
{
|
||||
if (interfaceState != _interfaceState) {
|
||||
if ((interfaceState & ASInterfaceStateMeasureLayout) != (_interfaceState & ASInterfaceStateMeasureLayout)) {
|
||||
// Trigger asynchronous measurement if it is not already cached or being calculated.
|
||||
}
|
||||
|
||||
// Entered or exited data loading state.
|
||||
if ((interfaceState & ASInterfaceStateFetchData) != (_interfaceState & ASInterfaceStateFetchData)) {
|
||||
if (interfaceState & ASInterfaceStateFetchData) {
|
||||
[self fetchData];
|
||||
} else {
|
||||
[self clearFetchedData];
|
||||
}
|
||||
}
|
||||
|
||||
// Entered or exited contents rendering state.
|
||||
if ((interfaceState & ASInterfaceStateDisplay) != (_interfaceState & ASInterfaceStateDisplay)) {
|
||||
if (interfaceState & ASInterfaceStateDisplay) {
|
||||
// Once the working window is eliminated (ASRangeHandlerRender), trigger display directly here.
|
||||
[self setDisplaySuspended:NO];
|
||||
} else {
|
||||
[self setDisplaySuspended:YES];
|
||||
[self clearContents];
|
||||
}
|
||||
}
|
||||
|
||||
// Entered or exited data loading state.
|
||||
if ((interfaceState & ASInterfaceStateVisible) != (_interfaceState & ASInterfaceStateVisible)) {
|
||||
if (interfaceState & ASInterfaceStateVisible) {
|
||||
// Consider providing a -didBecomeVisible.
|
||||
} else {
|
||||
// Consider providing a -didBecomeInvisible.
|
||||
}
|
||||
}
|
||||
|
||||
_interfaceState = interfaceState;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user