mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Potentially fix disappearing reactions
This commit is contained in:
parent
9027703897
commit
1843d3c824
@ -835,6 +835,7 @@ public final class ReactionNodePool {
|
|||||||
|
|
||||||
func putBack(view: ReactionButtonAsyncNode) {
|
func putBack(view: ReactionButtonAsyncNode) {
|
||||||
assert(view.superview == nil)
|
assert(view.superview == nil)
|
||||||
|
assert(view.layer.superlayer == nil)
|
||||||
|
|
||||||
if self.views.count < 64 {
|
if self.views.count < 64 {
|
||||||
view.reset()
|
view.reset()
|
||||||
@ -844,7 +845,12 @@ public final class ReactionNodePool {
|
|||||||
|
|
||||||
func take() -> Item {
|
func take() -> Item {
|
||||||
if !self.views.isEmpty {
|
if !self.views.isEmpty {
|
||||||
return Item(view: self.views.removeLast(), pool: self)
|
let view = self.views.removeLast()
|
||||||
|
view.layer.removeAllAnimations()
|
||||||
|
view.alpha = 1.0
|
||||||
|
view.isHidden = false
|
||||||
|
view.transform = .identity
|
||||||
|
return Item(view: view, pool: self)
|
||||||
} else {
|
} else {
|
||||||
return Item(view: ReactionButtonAsyncNode(), pool: self)
|
return Item(view: ReactionButtonAsyncNode(), pool: self)
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,8 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
reactionButtonPosition.y += item.size.height + 6.0
|
reactionButtonPosition.y += item.size.height + 6.0
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.node.view.superview == nil {
|
if item.node.view.superview != strongSelf.view {
|
||||||
|
assert(item.node.view.superview == nil)
|
||||||
strongSelf.view.addSubview(item.node.view)
|
strongSelf.view.addSubview(item.node.view)
|
||||||
item.node.view.frame = CGRect(origin: reactionButtonPosition, size: item.size)
|
item.node.view.frame = CGRect(origin: reactionButtonPosition, size: item.size)
|
||||||
|
|
||||||
@ -1072,6 +1073,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
|
|||||||
if animation.isAnimated {
|
if animation.isAnimated {
|
||||||
node.layer.animateScale(from: 1.0, to: 0.1, duration: 0.2, removeOnCompletion: false)
|
node.layer.animateScale(from: 1.0, to: 0.1, duration: 0.2, removeOnCompletion: false)
|
||||||
node.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak node] _ in
|
node.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak node] _ in
|
||||||
|
node?.layer.removeAllAnimations()
|
||||||
node?.removeFromSupernode()
|
node?.removeFromSupernode()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -308,7 +308,8 @@ final class MessageReactionButtonsNode: ASDisplayNode {
|
|||||||
strongSelf.backgroundMaskButtons[item.value] = itemMaskView
|
strongSelf.backgroundMaskButtons[item.value] = itemMaskView
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.node.view.superview == nil {
|
if item.node.view.superview != strongSelf.view {
|
||||||
|
assert(item.node.view.superview == nil)
|
||||||
strongSelf.view.addSubview(item.node.view)
|
strongSelf.view.addSubview(item.node.view)
|
||||||
if animation.isAnimated {
|
if animation.isAnimated {
|
||||||
item.node.view.layer.animateScale(from: 0.01, to: 1.0, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
|
item.node.view.layer.animateScale(from: 0.01, to: 1.0, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
|
||||||
@ -336,15 +337,18 @@ final class MessageReactionButtonsNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
item.node.view.additionalActivationProgressLayer = itemMaskView.layer
|
item.node.view.additionalActivationProgressLayer = itemMaskView.layer
|
||||||
|
|
||||||
if itemMaskView.superview == nil {
|
if let backgroundMaskView = strongSelf.backgroundMaskView {
|
||||||
strongSelf.backgroundMaskView?.addSubview(itemMaskView)
|
if itemMaskView.superview != backgroundMaskView {
|
||||||
if animation.isAnimated {
|
assert(itemMaskView.superview == nil)
|
||||||
itemMaskView.layer.animateScale(from: 0.01, to: 1.0, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
|
backgroundMaskView.addSubview(itemMaskView)
|
||||||
itemMaskView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
if animation.isAnimated {
|
||||||
|
itemMaskView.layer.animateScale(from: 0.01, to: 1.0, duration: 0.4, timingFunction: kCAMediaTimingFunctionSpring)
|
||||||
|
itemMaskView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
|
}
|
||||||
|
itemMaskView.frame = itemMaskFrame
|
||||||
|
} else {
|
||||||
|
animation.animator.updateFrame(layer: itemMaskView.layer, frame: itemMaskFrame, completion: nil)
|
||||||
}
|
}
|
||||||
itemMaskView.frame = itemMaskFrame
|
|
||||||
} else {
|
|
||||||
animation.animator.updateFrame(layer: itemMaskView.layer, frame: itemMaskFrame, completion: nil)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,6 +359,7 @@ final class MessageReactionButtonsNode: ASDisplayNode {
|
|||||||
if animation.isAnimated {
|
if animation.isAnimated {
|
||||||
view.layer.animateScale(from: 1.0, to: 0.01, duration: 0.2, removeOnCompletion: false)
|
view.layer.animateScale(from: 1.0, to: 0.01, duration: 0.2, removeOnCompletion: false)
|
||||||
view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak view] _ in
|
view.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak view] _ in
|
||||||
|
view?.layer.removeAllAnimations()
|
||||||
view?.removeFromSuperview()
|
view?.removeFromSuperview()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user