mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Adds trampoline for inserting and deletion of nodes
Currently measurement always needs to happen on the main thread if implicit hierarchy management is enabled as adding and removing from nodes needs to happen on the main thread. We now will trampoline to the main thread to do the insertion and deletion of nodes. This also resolves the issue that can occur if a node is already loaded deep in the layout hierarchy in the layout that the node is transforming to. Before insertion or deletion is happening we need to crawl the layout hierarchy to check that though.
This commit is contained in:
@@ -18,16 +18,45 @@
|
||||
|
||||
@interface ASLayoutTransition : NSObject <_ASTransitionContextLayoutDelegate>
|
||||
|
||||
/**
|
||||
* Node to apply layout transition on
|
||||
*/
|
||||
@property (nonatomic, readonly, weak) ASDisplayNode *node;
|
||||
@property (nonatomic, readonly, strong) ASLayout *pendingLayout;
|
||||
|
||||
/**
|
||||
* Previous layout to transition from
|
||||
*/
|
||||
@property (nonatomic, readonly, strong) ASLayout *previousLayout;
|
||||
|
||||
- (instancetype)initWithNode:(ASDisplayNode *)node
|
||||
pendingLayout:(ASLayout *)pendingLayout
|
||||
previousLayout:(ASLayout *)previousLayout;
|
||||
/**
|
||||
* Pending layout to transition to
|
||||
*/
|
||||
@property (nonatomic, readonly, strong) ASLayout *pendingLayout;
|
||||
|
||||
/**
|
||||
* Returns if the layout transition can happen asynchronously
|
||||
*/
|
||||
@property (nonatomic, readonly, assign) BOOL canTransitionAsynchronous;
|
||||
|
||||
/**
|
||||
* Returns a newly initialized layout transition
|
||||
*/
|
||||
- (instancetype)initWithNode:(ASDisplayNode *)node pendingLayout:(ASLayout *)pendingLayout previousLayout:(ASLayout *)previousLayout NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Insert and remove subnodes that where added or removed between the previousLayout and the pendingLayout
|
||||
*/
|
||||
- (void)applySubnodeTransition;
|
||||
|
||||
/**
|
||||
* Insert all new subnodes that where added between the previous layout and the pending layout
|
||||
*/
|
||||
- (void)applySubnodeInsertions;
|
||||
|
||||
/**
|
||||
* Remove all subnodes that are removed between the previous layout and the pending layout
|
||||
*/
|
||||
- (void)applySubnodeRemovals;
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user