Merge commit '3da4edd9ee224be1c8e73cda92ee32048ee6fdd6'

This commit is contained in:
Ali 2021-05-20 03:37:36 +04:00
commit 8557cd629a
3 changed files with 40 additions and 13 deletions

View File

@ -247,9 +247,14 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode {
self.labelContainerNode.frame = CGRect(origin: CGPoint(), size: size)
self.titleLabel.frame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: floor((size.height - totalHeight) / 2.0) + 84.0), size: titleSize)
self.subtitleLabel.frame = CGRect(origin: CGPoint(x: floor((size.width - subtitleSize.width) / 2.0), y: self.titleLabel.frame.maxY + 1.0), size: subtitleSize)
let titleLabelFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) / 2.0), y: floor((size.height - totalHeight) / 2.0) + 84.0), size: titleSize)
let subtitleLabelFrame = CGRect(origin: CGPoint(x: floor((size.width - subtitleSize.width) / 2.0), y: titleLabelFrame.maxY + 1.0), size: subtitleSize)
self.titleLabel.bounds = CGRect(origin: CGPoint(), size: titleLabelFrame.size)
self.titleLabel.position = titleLabelFrame.center
self.subtitleLabel.bounds = CGRect(origin: CGPoint(), size: subtitleLabelFrame.size)
self.subtitleLabel.position = subtitleLabelFrame.center
self.bottomNode.frame = CGRect(origin: CGPoint(), size: size)
self.containerNode.frame = CGRect(origin: CGPoint(), size: size)
@ -283,13 +288,17 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode {
transition.updateTransformScale(node: self.iconNode, scale: self.pressing ? smallIconScale * 0.9 : smallIconScale, delay: 0.0)
transition.updateAlpha(node: self.titleLabel, alpha: 0.0)
transition.updateAlpha(node: self.subtitleLabel, alpha: 0.0)
transition.updateSublayerTransformOffset(layer: self.labelContainerNode.layer, offset: CGPoint(x: 0.0, y: -50.0))
transition.updateSublayerTransformOffset(layer: self.labelContainerNode.layer, offset: CGPoint(x: 0.0, y: -43.0))
transition.updateTransformScale(node: self.titleLabel, scale: 0.8)
transition.updateTransformScale(node: self.subtitleLabel, scale: 0.8)
} else {
transition.updateTransformScale(node: self.backgroundNode, scale: 1.0, delay: 0.0)
transition.updateTransformScale(node: self.iconNode, scale: self.pressing ? 0.9 : 1.0, delay: 0.0)
transition.updateAlpha(node: self.titleLabel, alpha: 1.0, delay: 0.05)
transition.updateAlpha(node: self.subtitleLabel, alpha: 1.0, delay: 0.05)
transition.updateSublayerTransformOffset(layer: self.labelContainerNode.layer, offset: CGPoint())
transition.updateTransformScale(node: self.titleLabel, scale: 1.0)
transition.updateTransformScale(node: self.subtitleLabel, scale: 1.0)
}
transition.updateAlpha(layer: self.backgroundNode.maskProgressLayer, alpha: 1.0)
}

View File

@ -408,13 +408,13 @@ final class VoiceChatTileItemNode: ASDisplayNode {
// })
}
}
sourceNode.isHidden = true
Queue.mainQueue().after(0.4) {
sourceNode.isHidden = false
}
if animate {
sourceNode.isHidden = true
Queue.mainQueue().after(0.4) {
sourceNode.isHidden = false
}
let initialPosition = self.contextSourceNode.position
let targetContainerPosition = self.contextSourceNode.view.convert(self.contextSourceNode.bounds, to: containerNode.view).center
@ -434,6 +434,11 @@ final class VoiceChatTileItemNode: ASDisplayNode {
} else if !initialAnimate {
self.videoNode?.updateLayout(size: self.bounds.size, isLandscape: true, transition: .immediate)
self.videoNode?.frame = self.bounds
sourceNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration, timingFunction: timingFunction, removeOnCompletion: false, completion: { [weak sourceNode] _ in
sourceNode?.layer.removeAllAnimations()
})
sourceNode.layer.animateScale(from: 1.0, to: 0.0, duration: duration, timingFunction: timingFunction)
}
self.fadeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)

View File

@ -261,11 +261,11 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
strongSelf.removePlaceholder(animated: false)
} else {
strongSelf.imageNode.alpha = 0.0
strongSelf.animationNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
strongSelf.removePlaceholder(animated: true)
}
} else {
strongSelf.removePlaceholder(animated: true)
if strongSelf.setupTimestamp == nil {
strongSelf.removePlaceholder(animated: true)
}
}
firstTime = false
}
@ -389,6 +389,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
}
private var setupTimestamp: Double?
private func setupNode(item: ChatMessageItem) {
guard self.animationNode == nil else {
return
@ -421,6 +422,15 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
animationNode.started = { [weak self] in
if let strongSelf = self {
strongSelf.imageNode.alpha = 0.0
if !strongSelf.enableSynchronousImageApply {
let current = CACurrentMediaTime()
if let setupTimestamp = strongSelf.setupTimestamp, current - setupTimestamp > 0.3 {
strongSelf.animationNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
strongSelf.removePlaceholder(animated: true)
} else {
strongSelf.removePlaceholder(animated: false)
}
}
if let item = strongSelf.item {
if let _ = strongSelf.emojiFile {
@ -511,6 +521,9 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
}
if isPlaying && self.setupTimestamp == nil {
self.setupTimestamp = CACurrentMediaTime()
}
animationNode.visibility = isPlaying
if self.didSetUpAnimationNode && alreadySeen {