mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-13 06:49:23 +00:00
Merge commit '80f3f00f5bc8253498f99f8932c09797b5ad8f89'
This commit is contained in:
commit
dd768dfdeb
@ -347,4 +347,11 @@ final class GroupVideoNode: ASDisplayNode {
|
|||||||
let transition: ContainedViewLayoutTransition = .immediate
|
let transition: ContainedViewLayoutTransition = .immediate
|
||||||
transition.updateTransformRotation(view: self.videoView.view, angle: angle)
|
transition.updateTransformRotation(view: self.videoView.view, angle: angle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var snapshotView: UIView?
|
||||||
|
func storeSnapshot() {
|
||||||
|
if self.frame.size.width == 180.0 {
|
||||||
|
self.snapshotView = self.view.snapshotView(afterScreenUpdates: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2568,7 +2568,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateLocalVideoState() {
|
private func updateLocalVideoState() {
|
||||||
self.participantsContext?.updateVideoState(peerId: self.joinAsPeerId, isVideoMuted: self.videoCapturer == nil, isVideoPaused: self.isVideoMuted, isPresentationPaused: nil)
|
self.participantsContext?.updateVideoState(peerId: self.joinAsPeerId, isVideoMuted: self.videoCapturer == nil, isVideoPaused: self.isVideoMuted, isPresentationPaused: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func switchVideoCamera() {
|
public func switchVideoCamera() {
|
||||||
|
@ -483,9 +483,12 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
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 snapshotView = currentVideoNode.snapshotView
|
||||||
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: appearanceDuration)
|
strongSelf.videoContainerNode.layer.animateScale(from: videoContainerScale, to: 0.001, duration: appearanceDuration, completion: { _ in
|
||||||
|
snapshotView?.removeFromSuperview()
|
||||||
|
})
|
||||||
strongSelf.avatarNode.layer.animateScale(from: 0.0, to: 1.0, duration: appearanceDuration, 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
|
||||||
})
|
})
|
||||||
@ -494,6 +497,9 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
}
|
}
|
||||||
if currentVideoNode.supernode === strongSelf.videoContainerNode {
|
if currentVideoNode.supernode === strongSelf.videoContainerNode {
|
||||||
apperanceTransition.updateAlpha(node: currentVideoNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: currentVideoNode, alpha: 0.0)
|
||||||
|
} else if let snapshotView = snapshotView {
|
||||||
|
strongSelf.videoContainerNode.view.insertSubview(snapshotView, at: 0)
|
||||||
|
apperanceTransition.updateAlpha(layer: snapshotView.layer, alpha: 0.0)
|
||||||
}
|
}
|
||||||
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 0.0)
|
||||||
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 1.0)
|
||||||
@ -873,7 +879,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
|
|||||||
if !strongSelf.isExtracted && !strongSelf.animatingExtraction {
|
if !strongSelf.isExtracted && !strongSelf.animatingExtraction {
|
||||||
if videoNode.supernode !== strongSelf.videoContainerNode {
|
if videoNode.supernode !== strongSelf.videoContainerNode {
|
||||||
videoNode.clipsToBounds = true
|
videoNode.clipsToBounds = true
|
||||||
strongSelf.videoContainerNode.addSubnode(videoNode)
|
strongSelf.videoContainerNode.insertSubnode(videoNode, at: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
videoNode.position = CGPoint(x: videoSize.width / 2.0, y: videoSize.height / 2.0)
|
videoNode.position = CGPoint(x: videoSize.width / 2.0, y: videoSize.height / 2.0)
|
||||||
|
@ -39,6 +39,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
private let backgroundNode: ASDisplayNode
|
private let backgroundNode: ASDisplayNode
|
||||||
private let topFadeNode: ASDisplayNode
|
private let topFadeNode: ASDisplayNode
|
||||||
private let bottomFadeNode: ASDisplayNode
|
private let bottomFadeNode: ASDisplayNode
|
||||||
|
private let bottomGradientNode: ASDisplayNode
|
||||||
private let bottomFillNode: ASDisplayNode
|
private let bottomFillNode: ASDisplayNode
|
||||||
private let headerNode: ASDisplayNode
|
private let headerNode: ASDisplayNode
|
||||||
private let backButtonNode: HighlightableButtonNode
|
private let backButtonNode: HighlightableButtonNode
|
||||||
@ -106,7 +107,9 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.bottomFadeNode = ASDisplayNode()
|
self.bottomFadeNode = ASDisplayNode()
|
||||||
self.bottomFadeNode.displaysAsynchronously = false
|
|
||||||
|
self.bottomGradientNode = ASDisplayNode()
|
||||||
|
self.bottomGradientNode.displaysAsynchronously = false
|
||||||
if let image = generateImage(CGSize(width: fadeHeight, height: fadeHeight), rotatedContext: { size, context in
|
if let image = generateImage(CGSize(width: fadeHeight, height: fadeHeight), rotatedContext: { size, context in
|
||||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||||
context.clear(bounds)
|
context.clear(bounds)
|
||||||
@ -116,7 +119,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
let gradient = CGGradient(colorsSpace: deviceColorSpace, colors: colorsArray, locations: &locations)!
|
let gradient = CGGradient(colorsSpace: deviceColorSpace, colors: colorsArray, locations: &locations)!
|
||||||
context.drawLinearGradient(gradient, start: CGPoint(), end: CGPoint(x: 0.0, y: size.height), options: CGGradientDrawingOptions())
|
context.drawLinearGradient(gradient, start: CGPoint(), end: CGPoint(x: 0.0, y: size.height), options: CGGradientDrawingOptions())
|
||||||
}) {
|
}) {
|
||||||
self.bottomFadeNode.backgroundColor = UIColor(patternImage: image)
|
self.bottomGradientNode.backgroundColor = UIColor(patternImage: image)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.bottomFillNode = ASDisplayNode()
|
self.bottomFillNode = ASDisplayNode()
|
||||||
@ -200,7 +203,8 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
self.addSubnode(self.backdropAvatarNode)
|
self.addSubnode(self.backdropAvatarNode)
|
||||||
self.addSubnode(self.topFadeNode)
|
self.addSubnode(self.topFadeNode)
|
||||||
self.addSubnode(self.bottomFadeNode)
|
self.addSubnode(self.bottomFadeNode)
|
||||||
self.addSubnode(self.bottomFillNode)
|
self.bottomFadeNode.addSubnode(self.bottomGradientNode)
|
||||||
|
self.bottomFadeNode.addSubnode(self.bottomFillNode)
|
||||||
self.addSubnode(self.audioLevelNode)
|
self.addSubnode(self.audioLevelNode)
|
||||||
self.addSubnode(self.avatarNode)
|
self.addSubnode(self.avatarNode)
|
||||||
self.addSubnode(self.titleNode)
|
self.addSubnode(self.titleNode)
|
||||||
@ -433,7 +437,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
self.microphoneNode.alpha = 1.0
|
self.microphoneNode.alpha = 1.0
|
||||||
self.titleNode.alpha = 1.0
|
self.titleNode.alpha = 1.0
|
||||||
self.bottomFadeNode.alpha = 1.0
|
self.bottomFadeNode.alpha = 1.0
|
||||||
self.bottomFillNode.alpha = 1.0
|
|
||||||
}
|
}
|
||||||
alphaTransition.updateAlpha(node: self.topFadeNode, alpha: 0.0)
|
alphaTransition.updateAlpha(node: self.topFadeNode, alpha: 0.0)
|
||||||
alphaTransition.updateAlpha(node: self.titleNode, alpha: 0.0)
|
alphaTransition.updateAlpha(node: self.titleNode, alpha: 0.0)
|
||||||
@ -766,7 +769,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
private func setAvatarHidden(_ hidden: Bool) {
|
private func setAvatarHidden(_ hidden: Bool) {
|
||||||
self.topFadeNode.isHidden = !hidden
|
self.topFadeNode.isHidden = !hidden
|
||||||
self.bottomFadeNode.isHidden = !hidden
|
self.bottomFadeNode.isHidden = !hidden
|
||||||
self.bottomFillNode.isHidden = !hidden
|
|
||||||
self.avatarNode.isHidden = hidden
|
self.avatarNode.isHidden = hidden
|
||||||
self.audioLevelNode.isHidden = hidden
|
self.audioLevelNode.isHidden = hidden
|
||||||
}
|
}
|
||||||
@ -830,7 +832,10 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
videoNode.isMainstageExclusive = isMyPeer
|
videoNode.isMainstageExclusive = isMyPeer && !isPresentation
|
||||||
|
if videoNode.isMainstageExclusive {
|
||||||
|
videoNode.storeSnapshot()
|
||||||
|
}
|
||||||
videoNode.tapped = { [weak self] in
|
videoNode.tapped = { [weak self] in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
@ -873,7 +878,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
videoNode.alpha = 0.0
|
videoNode.alpha = 0.0
|
||||||
strongSelf.topFadeNode.isHidden = true
|
strongSelf.topFadeNode.isHidden = true
|
||||||
strongSelf.bottomFadeNode.isHidden = true
|
strongSelf.bottomFadeNode.isHidden = true
|
||||||
strongSelf.bottomFillNode.isHidden = true
|
|
||||||
} else if isMyPeer {
|
} else if isMyPeer {
|
||||||
videoNode.layer.removeAnimation(forKey: "opacity")
|
videoNode.layer.removeAnimation(forKey: "opacity")
|
||||||
videoNode.alpha = 1.0
|
videoNode.alpha = 1.0
|
||||||
@ -907,11 +911,8 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
if delayTransition {
|
if delayTransition {
|
||||||
strongSelf.topFadeNode.isHidden = false
|
strongSelf.topFadeNode.isHidden = false
|
||||||
strongSelf.bottomFadeNode.isHidden = false
|
strongSelf.bottomFadeNode.isHidden = false
|
||||||
strongSelf.bottomFillNode.isHidden = false
|
|
||||||
strongSelf.topFadeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
strongSelf.topFadeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||||
strongSelf.bottomFadeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
strongSelf.bottomFadeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
||||||
strongSelf.bottomFillNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3)
|
|
||||||
|
|
||||||
strongSelf.avatarNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
strongSelf.avatarNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
||||||
strongSelf.audioLevelNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
strongSelf.audioLevelNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
|
||||||
}
|
}
|
||||||
@ -992,7 +993,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
videoNode.updateIsBlurred(isBlurred: isPaused, light: true, animated: false)
|
videoNode.updateIsBlurred(isBlurred: isPaused, light: true, animated: false)
|
||||||
strongSelf.topFadeNode.isHidden = true
|
strongSelf.topFadeNode.isHidden = true
|
||||||
strongSelf.bottomFadeNode.isHidden = true
|
strongSelf.bottomFadeNode.isHidden = true
|
||||||
strongSelf.bottomFillNode.isHidden = true
|
|
||||||
if let videoNode = strongSelf.currentVideoNode {
|
if let videoNode = strongSelf.currentVideoNode {
|
||||||
videoNode.alpha = 1.0
|
videoNode.alpha = 1.0
|
||||||
videoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, completion: { [weak self] _ in
|
videoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.3, completion: { [weak self] _ in
|
||||||
@ -1031,7 +1031,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
transition.updateAlpha(node: self.titleNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
transition.updateAlpha(node: self.titleNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
||||||
transition.updateAlpha(node: self.microphoneNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
transition.updateAlpha(node: self.microphoneNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
||||||
transition.updateAlpha(node: self.bottomFadeNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
transition.updateAlpha(node: self.bottomFadeNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
||||||
transition.updateAlpha(node: self.bottomFillNode, alpha: hidden ? 0.0 : 1.0, delay: delay)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, isLandscape: Bool, isTablet: Bool, force: Bool = false, transition: ContainedViewLayoutTransition) {
|
func update(size: CGSize, sideInset: CGFloat, bottomInset: CGFloat, isLandscape: Bool, isTablet: Bool, force: Bool = false, transition: ContainedViewLayoutTransition) {
|
||||||
@ -1081,8 +1080,9 @@ final class VoiceChatMainStageNode: ASDisplayNode {
|
|||||||
if size.height != tileHeight && size.width < size.height {
|
if size.height != tileHeight && size.width < size.height {
|
||||||
totalFadeHeight += bottomInset
|
totalFadeHeight += bottomInset
|
||||||
}
|
}
|
||||||
transition.updateFrame(node: self.bottomFadeNode, frame: CGRect(x: 0.0, y: size.height - totalFadeHeight, width: size.width, height: fadeHeight))
|
transition.updateFrame(node: self.bottomFadeNode, frame: CGRect(x: 0.0, y: size.height - totalFadeHeight, width: size.width, height: totalFadeHeight))
|
||||||
transition.updateFrame(node: self.bottomFillNode, frame: CGRect(x: 0.0, y: size.height - totalFadeHeight + fadeHeight, width: size.width, height: max(0.0, totalFadeHeight - fadeHeight)))
|
transition.updateFrame(node: self.bottomGradientNode, frame: CGRect(x: 0.0, y: 0.0, width: size.width, height: fadeHeight))
|
||||||
|
transition.updateFrame(node: self.bottomFillNode, frame: CGRect(x: 0.0, y: fadeHeight, width: size.width, height: max(0.0, totalFadeHeight - fadeHeight)))
|
||||||
transition.updateFrame(node: self.topFadeNode, frame: CGRect(x: 0.0, y: 0.0, width: size.width, height: 50.0))
|
transition.updateFrame(node: self.topFadeNode, frame: CGRect(x: 0.0, y: 0.0, width: size.width, height: 50.0))
|
||||||
|
|
||||||
let backSize = self.backButtonNode.measure(CGSize(width: 320.0, height: 100.0))
|
let backSize = self.backButtonNode.measure(CGSize(width: 320.0, height: 100.0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user