Fix chat loading placeholder

This commit is contained in:
Ilya Laktyushin 2023-04-24 14:10:31 +04:00
parent 060bc61011
commit b4ffedcc3d

View File

@ -209,10 +209,12 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
if self.context.sharedContext.energyUsageSettings.fullTranslucency { if self.context.sharedContext.energyUsageSettings.fullTranslucency {
Queue.mainQueue().after(0.3) { Queue.mainQueue().after(0.3) {
if !self.didAnimateOut {
self.backgroundNode?.updateIsLooping(true) self.backgroundNode?.updateIsLooping(true)
} }
} }
} }
}
private var bottomInset: (Int, CGFloat)? private var bottomInset: (Int, CGFloat)?
func setup(_ historyNode: ChatHistoryNode, updating: Bool = false) { func setup(_ historyNode: ChatHistoryNode, updating: Bool = false) {
@ -282,11 +284,12 @@ final class ChatLoadingPlaceholderNode: ASDisplayNode {
self.borderMaskNode.bounds = self.borderMaskNode.bounds.offsetBy(dx: 0.0, dy: inset) self.borderMaskNode.bounds = self.borderMaskNode.bounds.offsetBy(dx: 0.0, dy: inset)
} }
private var didAnimateOut = false
func animateOut(_ historyNode: ChatHistoryNode, completion: @escaping () -> Void = {}) { func animateOut(_ historyNode: ChatHistoryNode, completion: @escaping () -> Void = {}) {
guard let listNode = historyNode as? ListView, let (size, _, _) = self.validLayout else { guard let listNode = historyNode as? ListView, let (size, _, _) = self.validLayout else {
return return
} }
self.didAnimateOut = true
self.backgroundNode?.updateIsLooping(false) self.backgroundNode?.updateIsLooping(false)
let transition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .spring) let transition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .spring)