mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 05:39:01 +00:00
[ASIndexedNodeContext] Do not cache the envTraitCollection, use the delegate to request it when needed (#2963)
Caching the envTraitCollection upon creation of `ASIndexedNodeContext` can lead to it becoming out of date. Ask the `id<ASEnvironment>` object for the trait collection when we need it.
This commit is contained in:
parent
d7670780b2
commit
39298f6694
@ -25,7 +25,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic, readonly, copy, nullable) NSString *supplementaryElementKind;
|
@property (nonatomic, readonly, copy, nullable) NSString *supplementaryElementKind;
|
||||||
@property (nonatomic, readonly, assign) ASSizeRange constrainedSize;
|
@property (nonatomic, readonly, assign) ASSizeRange constrainedSize;
|
||||||
@property (weak, nonatomic) id<ASEnvironment> environment;
|
@property (weak, nonatomic) id<ASEnvironment> environment;
|
||||||
@property (nonatomic, readonly, assign) ASEnvironmentTraitCollection environmentTraitCollection;
|
|
||||||
|
|
||||||
- (instancetype)initWithNodeBlock:(ASCellNodeBlock)nodeBlock
|
- (instancetype)initWithNodeBlock:(ASCellNodeBlock)nodeBlock
|
||||||
indexPath:(NSIndexPath *)indexPath
|
indexPath:(NSIndexPath *)indexPath
|
||||||
|
|||||||
@ -41,7 +41,6 @@
|
|||||||
_supplementaryElementKind = [supplementaryElementKind copy];
|
_supplementaryElementKind = [supplementaryElementKind copy];
|
||||||
_constrainedSize = constrainedSize;
|
_constrainedSize = constrainedSize;
|
||||||
_environment = environment;
|
_environment = environment;
|
||||||
_environmentTraitCollection = environment.environmentTraitCollection;
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -59,7 +58,7 @@
|
|||||||
node.cachedIndexPath = _indexPath;
|
node.cachedIndexPath = _indexPath;
|
||||||
node.supplementaryElementKind = _supplementaryElementKind;
|
node.supplementaryElementKind = _supplementaryElementKind;
|
||||||
node.owningNode = (ASDisplayNode *)_environment;
|
node.owningNode = (ASDisplayNode *)_environment;
|
||||||
ASEnvironmentStatePropagateDown(node, _environmentTraitCollection);
|
ASEnvironmentStatePropagateDown(node, [_environment environmentTraitCollection]);
|
||||||
_node = node;
|
_node = node;
|
||||||
}
|
}
|
||||||
return _node;
|
return _node;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user