Fix animated emoji blinking after playing

This commit is contained in:
Ilya Laktyushin 2021-05-21 22:19:16 +04:00
parent 06f609ed26
commit 039228439d

View File

@ -302,10 +302,10 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
} }
private func removePlaceholder(animated: Bool) { private func removePlaceholder(animated: Bool) {
self.placeholderNode.alpha = 0.0
if !animated { if !animated {
self.placeholderNode.removeFromSupernode() self.placeholderNode.removeFromSupernode()
} else { } else {
self.placeholderNode.alpha = 0.0
self.placeholderNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { [weak self] _ in self.placeholderNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { [weak self] _ in
self?.placeholderNode.removeFromSupernode() self?.placeholderNode.removeFromSupernode()
}) })
@ -425,8 +425,10 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
if !strongSelf.enableSynchronousImageApply { if !strongSelf.enableSynchronousImageApply {
let current = CACurrentMediaTime() let current = CACurrentMediaTime()
if let setupTimestamp = strongSelf.setupTimestamp, current - setupTimestamp > 0.3 { if let setupTimestamp = strongSelf.setupTimestamp, current - setupTimestamp > 0.3 {
strongSelf.animationNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) if !strongSelf.placeholderNode.alpha.isZero {
strongSelf.removePlaceholder(animated: true) strongSelf.animationNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
strongSelf.removePlaceholder(animated: true)
}
} else { } else {
strongSelf.removePlaceholder(animated: false) strongSelf.removePlaceholder(animated: false)
} }