mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 09:20:08 +00:00
Video Chat Improvements
This commit is contained in:
parent
bee3bd2314
commit
7a72ead1e5
@ -5621,7 +5621,8 @@ public final class VoiceChatController: ViewController {
|
|||||||
self.mainStageNode.alpha = 1.0
|
self.mainStageNode.alpha = 1.0
|
||||||
|
|
||||||
self.mainStageBackgroundNode.alpha = 1.0
|
self.mainStageBackgroundNode.alpha = 1.0
|
||||||
self.mainStageBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.13, completion: { _ in
|
self.mainStageBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.13, completion: { [weak otherItemNode] _ in
|
||||||
|
otherItemNode?.alpha = 0.0
|
||||||
completion()
|
completion()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -549,24 +549,25 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
|
|
||||||
let videoContainerScale = tileSize.width / videoSize.width
|
let videoContainerScale = tileSize.width / videoSize.width
|
||||||
|
|
||||||
|
let appearanceDuration: Double = 0.25
|
||||||
|
let apperanceTransition = ContainedViewLayoutTransition.animated(duration: appearanceDuration, curve: .easeInOut)
|
||||||
let videoNode = item.getVideo()
|
let videoNode = item.getVideo()
|
||||||
if let currentVideoNode = strongSelf.videoNode, currentVideoNode !== videoNode {
|
if let currentVideoNode = strongSelf.videoNode, currentVideoNode !== videoNode {
|
||||||
if videoNode == nil {
|
if videoNode == nil {
|
||||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut)
|
|
||||||
if strongSelf.avatarNode.alpha.isZero {
|
if strongSelf.avatarNode.alpha.isZero {
|
||||||
strongSelf.animatingSelection = true
|
strongSelf.animatingSelection = true
|
||||||
strongSelf.videoContainerNode.layer.animateScale(from: videoContainerScale, to: 0.001, duration: 0.2)
|
strongSelf.videoContainerNode.layer.animateScale(from: videoContainerScale, to: 0.001, duration: appearanceDuration)
|
||||||
strongSelf.avatarNode.layer.animateScale(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak self] _ in
|
strongSelf.avatarNode.layer.animateScale(from: 0.0, to: 1.0, duration: appearanceDuration, completion: { [weak self] _ in
|
||||||
self?.animatingSelection = false
|
self?.animatingSelection = false
|
||||||
})
|
})
|
||||||
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -9.0), duration: 0.2, additive: true)
|
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -9.0), duration: appearanceDuration, additive: true)
|
||||||
strongSelf.audioLevelView?.layer.animateScale(from: 0.0, to: 1.0, duration: 0.2)
|
strongSelf.audioLevelView?.layer.animateScale(from: 0.0, to: 1.0, duration: appearanceDuration)
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: currentVideoNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: currentVideoNode, alpha: 0.0)
|
||||||
transition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
||||||
transition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
||||||
if let audioLevelView = strongSelf.audioLevelView {
|
if let audioLevelView = strongSelf.audioLevelView {
|
||||||
transition.updateAlpha(layer: audioLevelView.layer, alpha: 1.0)
|
apperanceTransition.updateAlpha(layer: audioLevelView.layer, alpha: 1.0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
currentVideoNode.removeFromSupernode()
|
currentVideoNode.removeFromSupernode()
|
||||||
@ -874,42 +875,41 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
let canUpdateAvatarVisibility = !strongSelf.isExtracted && !strongSelf.animatingExtraction
|
let canUpdateAvatarVisibility = !strongSelf.isExtracted && !strongSelf.animatingExtraction
|
||||||
|
|
||||||
if let videoNode = videoNode {
|
if let videoNode = videoNode {
|
||||||
let transition = ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut)
|
|
||||||
if !strongSelf.isExtracted && !strongSelf.animatingExtraction {
|
if !strongSelf.isExtracted && !strongSelf.animatingExtraction {
|
||||||
if currentItem != nil {
|
if currentItem != nil {
|
||||||
if item.active {
|
if item.active {
|
||||||
if strongSelf.avatarNode.alpha.isZero {
|
if strongSelf.avatarNode.alpha.isZero {
|
||||||
strongSelf.animatingSelection = true
|
strongSelf.animatingSelection = true
|
||||||
strongSelf.videoContainerNode.layer.animateScale(from: videoContainerScale, to: 0.001, duration: 0.2)
|
strongSelf.videoContainerNode.layer.animateScale(from: videoContainerScale, to: 0.001, duration: appearanceDuration)
|
||||||
strongSelf.avatarNode.layer.animateScale(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak self] _ in
|
strongSelf.avatarNode.layer.animateScale(from: 0.0, to: 1.0, duration: appearanceDuration, completion: { [weak self] _ in
|
||||||
self?.animatingSelection = false
|
self?.animatingSelection = false
|
||||||
})
|
})
|
||||||
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -9.0), duration: 0.2, additive: true)
|
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: -9.0), duration: appearanceDuration, additive: true)
|
||||||
strongSelf.audioLevelView?.layer.animateScale(from: 0.0, to: 1.0, duration: 0.2)
|
strongSelf.audioLevelView?.layer.animateScale(from: 0.0, to: 1.0, duration: appearanceDuration)
|
||||||
}
|
}
|
||||||
if videoNodeUpdated {
|
if videoNodeUpdated {
|
||||||
videoNode.alpha = 0.0
|
videoNode.alpha = 0.0
|
||||||
strongSelf.videoFadeNode.alpha = 0.0
|
strongSelf.videoFadeNode.alpha = 0.0
|
||||||
} else {
|
} else {
|
||||||
transition.updateAlpha(node: videoNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: videoNode, alpha: 0.0)
|
||||||
transition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
||||||
if let audioLevelView = strongSelf.audioLevelView {
|
if let audioLevelView = strongSelf.audioLevelView {
|
||||||
transition.updateAlpha(layer: audioLevelView.layer, alpha: 1.0)
|
apperanceTransition.updateAlpha(layer: audioLevelView.layer, alpha: 1.0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !strongSelf.avatarNode.alpha.isZero {
|
if !strongSelf.avatarNode.alpha.isZero {
|
||||||
strongSelf.videoContainerNode.layer.animateScale(from: 0.001, to: videoContainerScale, duration: 0.2)
|
strongSelf.videoContainerNode.layer.animateScale(from: 0.001, to: videoContainerScale, duration: appearanceDuration)
|
||||||
strongSelf.avatarNode.layer.animateScale(from: 1.0, to: 0.001, duration: 0.2)
|
strongSelf.avatarNode.layer.animateScale(from: 1.0, to: 0.001, duration: appearanceDuration)
|
||||||
strongSelf.audioLevelView?.layer.animateScale(from: 1.0, to: 0.001, duration: 0.2)
|
strongSelf.audioLevelView?.layer.animateScale(from: 1.0, to: 0.001, duration: appearanceDuration)
|
||||||
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(x: 0.0, y: -9.0), to: CGPoint(), duration: 0.2, additive: true)
|
strongSelf.videoContainerNode.layer.animatePosition(from: CGPoint(x: 0.0, y: -9.0), to: CGPoint(), duration: appearanceDuration, additive: true)
|
||||||
}
|
}
|
||||||
transition.updateAlpha(node: videoNode, alpha: 1.0)
|
apperanceTransition.updateAlpha(node: videoNode, alpha: 1.0)
|
||||||
transition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 1.0)
|
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 1.0)
|
||||||
transition.updateAlpha(node: strongSelf.avatarNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 0.0)
|
||||||
if let audioLevelView = strongSelf.audioLevelView {
|
if let audioLevelView = strongSelf.audioLevelView {
|
||||||
transition.updateAlpha(layer: audioLevelView.layer, alpha: 0.0)
|
apperanceTransition.updateAlpha(layer: audioLevelView.layer, alpha: 0.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -944,8 +944,8 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
videoNode.alpha = 0.0
|
videoNode.alpha = 0.0
|
||||||
} else {
|
} else {
|
||||||
strongSelf.avatarNode.alpha = 0.0
|
strongSelf.avatarNode.alpha = 0.0
|
||||||
strongSelf.avatarNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2)
|
strongSelf.avatarNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: appearanceDuration)
|
||||||
videoNode.layer.animateScale(from: 0.01, to: 1.0, duration: 0.2)
|
videoNode.layer.animateScale(from: 0.01, to: 1.0, duration: appearanceDuration)
|
||||||
videoNode.alpha = 1.0
|
videoNode.alpha = 1.0
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -322,8 +322,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
transition.updateFrame(view: snapshotView, frame: infoFrame)
|
transition.updateFrame(view: snapshotView, frame: infoFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceNode.alpha = 0.0
|
|
||||||
|
|
||||||
self.animatingIn = true
|
self.animatingIn = true
|
||||||
let startLocalFrame = sourceNode.view.convert(sourceNode.bounds, to: self.supernode?.view)
|
let startLocalFrame = sourceNode.view.convert(sourceNode.bounds, to: self.supernode?.view)
|
||||||
self.update(size: startLocalFrame.size, sideInset: sideInset, bottomInset: bottomInset, isLandscape: isLandscape, force: true, transition: .immediate)
|
self.update(size: startLocalFrame.size, sideInset: sideInset, bottomInset: bottomInset, isLandscape: isLandscape, force: true, transition: .immediate)
|
||||||
@ -695,14 +693,16 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
|> filter { $0 }
|
|> filter { $0 }
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] _ in
|
|> deliverOnMainQueue).start(next: { [weak self] _ in
|
||||||
Queue.mainQueue().after(0.07) {
|
Queue.mainQueue().after(0.1) {
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let (size, sideInset, bottomInset, isLandscape) = strongSelf.validLayout {
|
if let (size, sideInset, bottomInset, isLandscape) = strongSelf.validLayout {
|
||||||
strongSelf.update(size: size, sideInset: sideInset, bottomInset: bottomInset, isLandscape: isLandscape, transition: .immediate)
|
strongSelf.update(size: size, sideInset: sideInset, bottomInset: bottomInset, isLandscape: isLandscape, transition: .immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Queue.mainQueue().after(0.02) {
|
||||||
completion?()
|
completion?()
|
||||||
|
}
|
||||||
|
|
||||||
if delayTransition {
|
if delayTransition {
|
||||||
if let videoNode = strongSelf.currentVideoNode {
|
if let videoNode = strongSelf.currentVideoNode {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user