Don't animate avatar with the bubble

This commit is contained in:
Ali 2020-10-27 20:13:49 +04:00
parent 50386f0bd4
commit 29ce4b4aca

View File

@ -544,33 +544,34 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
self.shadowNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2) self.shadowNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
if let subnodes = self.subnodes { func process(node: ASDisplayNode) {
for node in subnodes { if node === self.accessoryItemNode {
if let contextNode = node as? ContextExtractedContentContainingNode { return
if let contextSubnodes = contextNode.contentNode.subnodes {
inner: for contextSubnode in contextSubnodes {
if contextSubnode !== self.accessoryItemNode {
if contextSubnode == self.backgroundNode {
if self.backgroundNode.hasImage && self.backgroundWallpaperNode.hasImage {
continue inner
} }
}
contextSubnode.layer.allowsGroupOpacity = true if node !== self {
contextSubnode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak contextSubnode] _ in switch node {
contextSubnode?.layer.allowsGroupOpacity = false case _ as ContextExtractedContentContainingNode, _ as ContextControllerSourceNode, _ as ContextExtractedContentNode:
}) break
} default:
}
}
} else if node !== self.accessoryItemNode {
node.layer.allowsGroupOpacity = true node.layer.allowsGroupOpacity = true
node.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
node.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak node] _ in node.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak node] _ in
node?.layer.allowsGroupOpacity = false node?.layer.allowsGroupOpacity = false
}) })
return
} }
} }
guard let subnodes = node.subnodes else {
return
} }
for subnode in subnodes {
process(node: subnode)
}
}
process(node: self)
} }
override func animateRemoved(_ currentTimestamp: Double, duration: Double) { override func animateRemoved(_ currentTimestamp: Double, duration: Double) {
@ -588,11 +589,16 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
override func animateAdded(_ currentTimestamp: Double, duration: Double) { override func animateAdded(_ currentTimestamp: Double, duration: Double) {
super.animateAdded(currentTimestamp, duration: duration) super.animateAdded(currentTimestamp, duration: duration)
self.allowsGroupOpacity = true if let subnodes = self.subnodes {
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak self] _ in for subnode in subnodes {
self?.allowsGroupOpacity = false let layer = subnode.layer
layer.allowsGroupOpacity = true
layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak layer] _ in
layer?.allowsGroupOpacity = false
}) })
} }
}
}
override func didLoad() { override func didLoad() {
super.didLoad() super.didLoad()