mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-11 17:00:02 +00:00
Fixes an issue with GIFs that would always be covered by their placeholder (#326)
Also adds a subclass override for when the animated image is set.
This commit is contained in:
parent
4d0eeb64d8
commit
d5f10652c6
@ -1,6 +1,7 @@
|
|||||||
## master
|
## master
|
||||||
|
|
||||||
* Add your own contributions to the next release on the line below this with your name.
|
* Add your own contributions to the next release on the line below this with your name.
|
||||||
|
- Fixed an issue where GIFs with placeholders never had their placeholders uncover the GIF. [Garrett Moon](https://github.com/garrettmoon)
|
||||||
- [Yoga] Implement ASYogaLayoutSpec, a simplified integration strategy for Yoga-powered layout calculation. [Scott Goodson](https://github.com/appleguy)
|
- [Yoga] Implement ASYogaLayoutSpec, a simplified integration strategy for Yoga-powered layout calculation. [Scott Goodson](https://github.com/appleguy)
|
||||||
- Fixed an issue where calls to setNeedsDisplay and setNeedsLayout would stop working on loaded nodes. [Garrett Moon](https://github.com/garrettmoon)
|
- Fixed an issue where calls to setNeedsDisplay and setNeedsLayout would stop working on loaded nodes. [Garrett Moon](https://github.com/garrettmoon)
|
||||||
- [ASTextKitFontSizeAdjuster] [Ricky Cancro] Replace use of NSAttributedString's boundingRectWithSize:options:context: with NSLayoutManager's boundingRectForGlyphRange:inTextContainer:
|
- [ASTextKitFontSizeAdjuster] [Ricky Cancro] Replace use of NSAttributedString's boundingRectWithSize:options:context: with NSLayoutManager's boundingRectForGlyphRange:inTextContainer:
|
||||||
|
|||||||
@ -53,6 +53,7 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
id <ASAnimatedImageProtocol> previousAnimatedImage = _animatedImage;
|
||||||
_animatedImage = animatedImage;
|
_animatedImage = animatedImage;
|
||||||
|
|
||||||
if (animatedImage != nil) {
|
if (animatedImage != nil) {
|
||||||
@ -73,6 +74,13 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self animatedImageSet:_animatedImage previousAnimatedImage:previousAnimatedImage];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)animatedImageSet:(id <ASAnimatedImageProtocol>)newAnimatedImage previousAnimatedImage:(id <ASAnimatedImageProtocol>)previousAnimatedImage
|
||||||
|
{
|
||||||
|
//Subclasses may override
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id <ASAnimatedImageProtocol>)animatedImage
|
- (id <ASAnimatedImageProtocol>)animatedImage
|
||||||
@ -301,6 +309,7 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
|
|||||||
self.lastDisplayLinkFire = 0;
|
self.lastDisplayLinkFire = 0;
|
||||||
} else {
|
} else {
|
||||||
self.contents = (__bridge id)frameImage;
|
self.contents = (__bridge id)frameImage;
|
||||||
|
[self displayDidFinish];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -148,6 +148,9 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
|
|||||||
*
|
*
|
||||||
* @discussion Set this to an object which conforms to ASAnimatedImageProtocol
|
* @discussion Set this to an object which conforms to ASAnimatedImageProtocol
|
||||||
* to have the ASImageNode playback an animated image.
|
* to have the ASImageNode playback an animated image.
|
||||||
|
* @warning this method should not be overridden, it may not always be called as
|
||||||
|
* another method is used internally. If you need to know when the animatedImage
|
||||||
|
* is set, override @c animatedImageSet:previousAnimatedImage:
|
||||||
*/
|
*/
|
||||||
@property (nullable, nonatomic, strong) id <ASAnimatedImageProtocol> animatedImage;
|
@property (nullable, nonatomic, strong) id <ASAnimatedImageProtocol> animatedImage;
|
||||||
|
|
||||||
@ -168,6 +171,15 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
|
|||||||
*/
|
*/
|
||||||
@property (nonatomic, strong) NSString *animatedImageRunLoopMode;
|
@property (nonatomic, strong) NSString *animatedImageRunLoopMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @abstract Method called when animated image has been set
|
||||||
|
*
|
||||||
|
* @discussion This method is for subclasses to override so they can know if an animated image
|
||||||
|
* has been set on the node.
|
||||||
|
* @warning this method is called with the node's lock held.
|
||||||
|
*/
|
||||||
|
- (void)animatedImageSet:(id <ASAnimatedImageProtocol>)newAnimatedImage previousAnimatedImage:(id <ASAnimatedImageProtocol>)previousAnimatedImage;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface ASImageNode (Unavailable)
|
@interface ASImageNode (Unavailable)
|
||||||
|
|||||||
@ -257,7 +257,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
|||||||
|
|
||||||
- (BOOL)placeholderShouldPersist
|
- (BOOL)placeholderShouldPersist
|
||||||
{
|
{
|
||||||
return (self.image == nil && self.imageIdentifiers.count > 0);
|
return (self.image == nil && self.animatedImage == nil && self.imageIdentifiers.count > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* displayWillStart in ASNetworkImageNode has a very similar implementation. Changes here are likely necessary
|
/* displayWillStart in ASNetworkImageNode has a very similar implementation. Changes here are likely necessary
|
||||||
|
|||||||
@ -309,7 +309,7 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
|
|||||||
- (BOOL)placeholderShouldPersist
|
- (BOOL)placeholderShouldPersist
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(__instanceLock__);
|
ASDN::MutexLocker l(__instanceLock__);
|
||||||
return (self.image == nil && _URL != nil);
|
return (self.image == nil && self.animatedImage == nil && _URL != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* displayWillStart in ASMultiplexImageNode has a very similar implementation. Changes here are likely necessary
|
/* displayWillStart in ASMultiplexImageNode has a very similar implementation. Changes here are likely necessary
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user