mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Change placeholder boolean to time interval
This commit is contained in:
@@ -332,11 +332,11 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
|
|||||||
@property (nonatomic, assign) BOOL placeholderEnabled;
|
@property (nonatomic, assign) BOOL placeholderEnabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract Toggle to fade-out the placeholder when a node's contents are finished displaying.
|
* @abstract Set the time it takes to fade out the placeholder when a node's contents are finished displaying.
|
||||||
*
|
*
|
||||||
* @discussion Defaults to NO.
|
* @discussion Defaults to 0 seconds.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) BOOL placeholderFadesOut;
|
@property (nonatomic, assign) NSTimeInterval placeholderFadeDuration;
|
||||||
|
|
||||||
|
|
||||||
/** @name Hit Testing */
|
/** @name Hit Testing */
|
||||||
@@ -535,4 +535,8 @@ typedef CALayer *(^ASDisplayNodeLayerBlock)();
|
|||||||
* Convenience method, equivalent to [layer addSublayer:node.layer].
|
* Convenience method, equivalent to [layer addSublayer:node.layer].
|
||||||
*/
|
*/
|
||||||
- (void)addSubnode:(ASDisplayNode *)node;
|
- (void)addSubnode:(ASDisplayNode *)node;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface ASDisplayNode (Deprecated)
|
||||||
|
@property (nonatomic, assign) BOOL placeholderFadesOut ASDISPLAYNODE_DEPRECATED;
|
||||||
|
@end
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ void ASDisplayNodePerformBlockOnMainThread(void (^block)())
|
|||||||
_flags.implementsImageDisplay = ([[self class] respondsToSelector:@selector(displayWithParameters:isCancelled:)] ? 1 : 0);
|
_flags.implementsImageDisplay = ([[self class] respondsToSelector:@selector(displayWithParameters:isCancelled:)] ? 1 : 0);
|
||||||
_flags.implementsDrawParameters = ([self respondsToSelector:@selector(drawParametersForAsyncLayer:)] ? 1 : 0);
|
_flags.implementsDrawParameters = ([self respondsToSelector:@selector(drawParametersForAsyncLayer:)] ? 1 : 0);
|
||||||
|
|
||||||
_fadeAnimationDuration = 0.1;
|
|
||||||
|
|
||||||
ASDisplayNodeMethodOverrides overrides = ASDisplayNodeMethodOverrideNone;
|
ASDisplayNodeMethodOverrides overrides = ASDisplayNodeMethodOverrideNone;
|
||||||
if (ASDisplayNodeSubclassOverridesSelector([self class], @selector(touchesBegan:withEvent:))) {
|
if (ASDisplayNodeSubclassOverridesSelector([self class], @selector(touchesBegan:withEvent:))) {
|
||||||
overrides |= ASDisplayNodeMethodOverrideTouchesBegan;
|
overrides |= ASDisplayNodeMethodOverrideTouchesBegan;
|
||||||
@@ -1235,10 +1233,10 @@ static NSInteger incrementIfFound(NSInteger i) {
|
|||||||
[self _tearDownPlaceholderLayer];
|
[self _tearDownPlaceholderLayer];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (self.placeholderFadesOut) {
|
if (_placeholderFadeDuration > 0.0) {
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setCompletionBlock:cleanupBlock];
|
[CATransaction setCompletionBlock:cleanupBlock];
|
||||||
[CATransaction setAnimationDuration:_fadeAnimationDuration];
|
[CATransaction setAnimationDuration:_placeholderFadeDuration];
|
||||||
_placeholderLayer.opacity = 0.0;
|
_placeholderLayer.opacity = 0.0;
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
} else {
|
} else {
|
||||||
@@ -1774,3 +1772,18 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode";
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation ASDisplayNode (Deprecated)
|
||||||
|
|
||||||
|
- (void)setPlaceholderFadesOut:(BOOL)placeholderFadesOut
|
||||||
|
{
|
||||||
|
self.placeholderFadeDuration = placeholderFadesOut ? 0.1 : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)placeholderFadesOut
|
||||||
|
{
|
||||||
|
return self.placeholderFadeDuration > 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|||||||
@@ -71,8 +71,6 @@ typedef NS_OPTIONS(NSUInteger, ASDisplayNodeMethodOverrides) {
|
|||||||
|
|
||||||
_ASPendingState *_pendingViewState;
|
_ASPendingState *_pendingViewState;
|
||||||
|
|
||||||
NSTimeInterval _fadeAnimationDuration;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// public properties
|
// public properties
|
||||||
unsigned synchronous:1;
|
unsigned synchronous:1;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static CGFloat const kASDKLogoAspectRatio = 2.79;
|
|||||||
{
|
{
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
self.placeholderEnabled = YES;
|
self.placeholderEnabled = YES;
|
||||||
self.placeholderFadesOut = YES;
|
self.placeholderFadeDuration = 0.1;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user