Merge commit '5034080e930654079b1642c0561cb367c5f6a7f7'

This commit is contained in:
Ali 2021-05-27 13:23:02 +04:00
commit 36e87d96eb
6 changed files with 26 additions and 20 deletions

View File

@ -1076,9 +1076,9 @@ public final class PeerInfoAvatarListContainerNode: ASDisplayNode {
} }
let stripInset: CGFloat = 8.0 let stripInset: CGFloat = 8.0
let stripSpacing: CGFloat = 4.0 let stripSpacing: CGFloat = 4.0
let stripWidth: CGFloat = max(5.0, floor((size.width - stripInset * 2.0 - stripSpacing * CGFloat(self.stripNodes.count - 1)) / CGFloat(self.stripNodes.count))) let stripWidth: CGFloat = max(5.0, floorToScreenPixels((size.width - stripInset * 2.0 - stripSpacing * CGFloat(self.stripNodes.count - 1)) / CGFloat(self.stripNodes.count)))
let currentStripMinX = stripInset + CGFloat(self.currentIndex) * (stripWidth + stripSpacing) let currentStripMinX = stripInset + CGFloat(self.currentIndex) * (stripWidth + stripSpacing)
let currentStripMidX = floor(currentStripMinX + stripWidth / 2.0) let currentStripMidX = floorToScreenPixels(currentStripMinX + stripWidth / 2.0)
let lastStripMaxX = stripInset + CGFloat(self.stripNodes.count - 1) * (stripWidth + stripSpacing) + stripWidth let lastStripMaxX = stripInset + CGFloat(self.stripNodes.count - 1) * (stripWidth + stripSpacing) + stripWidth
let stripOffset: CGFloat = min(0.0, max(size.width - stripInset - lastStripMaxX, size.width / 2.0 - currentStripMidX)) let stripOffset: CGFloat = min(0.0, max(size.width - stripInset - lastStripMaxX, size.width / 2.0 - currentStripMidX))
for i in 0 ..< self.stripNodes.count { for i in 0 ..< self.stripNodes.count {

View File

@ -301,7 +301,7 @@ private class VoiceChatCameraPreviewControllerNode: ViewControllerTracingNode, U
} }
self.readyDisposable.set(self.cameraNode.ready.start(next: { [weak self] ready in self.readyDisposable.set(self.cameraNode.ready.start(next: { [weak self] ready in
if let strongSelf = self { if let strongSelf = self, ready {
Queue.mainQueue().after(0.07) { Queue.mainQueue().after(0.07) {
strongSelf.shimmerNode.alpha = 0.0 strongSelf.shimmerNode.alpha = 0.0
strongSelf.shimmerNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3) strongSelf.shimmerNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3)

View File

@ -494,9 +494,13 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
switch item.color { switch item.color {
case .accent: case .accent:
wavesColor = accentColor wavesColor = accentColor
if case .wantsToSpeak = item.icon {
gradient = .muted
}
case .constructive: case .constructive:
gradient = .speaking gradient = .speaking
case .destructive: case .destructive:
gradient = .mutedForYou
wavesColor = destructiveColor wavesColor = destructiveColor
default: default:
break break
@ -629,7 +633,6 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
transition = .immediate transition = .immediate
} }
if titleUpdated, let snapshotView = strongSelf.titleNode.view.snapshotContentTree() { if titleUpdated, let snapshotView = strongSelf.titleNode.view.snapshotContentTree() {
strongSelf.titleNode.view.superview?.addSubview(snapshotView) strongSelf.titleNode.view.superview?.addSubview(snapshotView)
snapshotView.frame = strongSelf.titleNode.view.frame snapshotView.frame = strongSelf.titleNode.view.frame
@ -773,7 +776,7 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
nodeToAnimateIn = animationNode nodeToAnimateIn = animationNode
} }
var color = color var color = color
if hasVideo || color.rgb == 0x979797 { if (hasVideo && !item.active) || color.rgb == 0x979797 {
color = UIColor(rgb: 0xffffff) color = UIColor(rgb: 0xffffff)
} }
animationNode.update(state: VoiceChatMicrophoneNode.State(muted: muted, filled: true, color: color), animated: true) animationNode.update(state: VoiceChatMicrophoneNode.State(muted: muted, filled: true, color: color), animated: true)

View File

@ -525,17 +525,21 @@ final class VoiceChatMainStageNode: ASDisplayNode {
var mutedForYou = false var mutedForYou = false
switch state { switch state {
case .listening: case .listening:
if let muteState = peerEntry.muteState, muteState.mutedByYou { if let muteState = peerEntry.muteState {
gradient = .muted
muted = true muted = true
mutedForYou = true if muteState.mutedByYou {
gradient = .mutedForYou
mutedForYou = true
} else if !muteState.canUnmute {
gradient = .muted
}
} else { } else {
gradient = .active gradient = .active
muted = peerEntry.muteState != nil muted = peerEntry.muteState != nil
} }
case .speaking: case .speaking:
if let muteState = peerEntry.muteState, muteState.mutedByYou { if let muteState = peerEntry.muteState, muteState.mutedByYou {
gradient = .muted gradient = .mutedForYou
muted = true muted = true
mutedForYou = true mutedForYou = true
} else { } else {
@ -858,6 +862,7 @@ class VoiceChatBlobNode: ASDisplayNode {
case speaking case speaking
case active case active
case connecting case connecting
case mutedForYou
case muted case muted
} }
private let size: CGSize private let size: CGSize
@ -978,6 +983,8 @@ class VoiceChatBlobNode: ASDisplayNode {
targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor] targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor]
case .connecting: case .connecting:
targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor] targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor]
case .mutedForYou:
targetColors = [pink.cgColor, destructiveColor.cgColor, destructiveColor.cgColor]
case .muted: case .muted:
targetColors = [pink.cgColor, purple.cgColor, purple.cgColor] targetColors = [pink.cgColor, purple.cgColor, purple.cgColor]
} }

View File

@ -191,9 +191,7 @@ final class VoiceChatTileItemNode: ASDisplayNode {
gesture.cancel() gesture.cancel()
return return
} }
if item.videoReady { contextAction(strongSelf.contextSourceNode, gesture)
contextAction(strongSelf.contextSourceNode, gesture)
}
} }
self.contextSourceNode.willUpdateIsExtractedToContextPreview = { [weak self] isExtracted, transition in self.contextSourceNode.willUpdateIsExtractedToContextPreview = { [weak self] isExtracted, transition in
guard let strongSelf = self, let _ = strongSelf.item else { guard let strongSelf = self, let _ = strongSelf.item else {
@ -218,7 +216,7 @@ final class VoiceChatTileItemNode: ASDisplayNode {
} }
@objc private func tap() { @objc private func tap() {
if let item = self.item, item.videoReady { if let item = self.item {
item.action() item.action()
} }
} }
@ -276,9 +274,7 @@ final class VoiceChatTileItemNode: ASDisplayNode {
if self.item != item { if self.item != item {
let previousItem = self.item let previousItem = self.item
self.item = item self.item = item
self.containerNode.isGestureEnabled = item.videoReady
if !item.videoReady { if !item.videoReady {
let shimmerNode: VoiceChatTileShimmeringNode let shimmerNode: VoiceChatTileShimmeringNode
if let current = self.shimmerNode { if let current = self.shimmerNode {
@ -502,7 +498,7 @@ class VoiceChatTileHighlightNode: ASDisplayNode {
enum Gradient { enum Gradient {
case speaking case speaking
case active case active
case connecting case mutedForYou
case muted case muted
} }
@ -632,8 +628,8 @@ class VoiceChatTileHighlightNode: ASDisplayNode {
targetColors = [activeBlue.cgColor, green.cgColor, green.cgColor] targetColors = [activeBlue.cgColor, green.cgColor, green.cgColor]
case .active: case .active:
targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor] targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor]
case .connecting: case .mutedForYou:
targetColors = [lightBlue.cgColor, blue.cgColor, blue.cgColor] targetColors = [pink.cgColor, destructiveColor.cgColor, destructiveColor.cgColor]
case .muted: case .muted:
targetColors = [pink.cgColor, purple.cgColor, purple.cgColor] targetColors = [pink.cgColor, purple.cgColor, purple.cgColor]
} }

@ -1 +1 @@
Subproject commit abd71799a40446115ba7a3f0f77355686dd1a1f4 Subproject commit e75e19b1ded7a8512d50b6e0be83408376ca0838