Merge commit '3b34ee26b7c716dfa8c3128202e086bc0cafa740'

This commit is contained in:
Ali 2021-06-11 19:01:15 +04:00
commit b4dd081cad
10 changed files with 1393 additions and 1378 deletions

View File

@ -6493,3 +6493,5 @@ Sorry for the inconvenience.";
"VoiceChat.NoiseSuppressionDisabled" = "Disabled";
"VoiceChat.Unpin" = "Unpin";
"VoiceChat.VideoParticipantsLimitExceeded" = "Video is only available\nfor the first 30 members";

View File

@ -1434,7 +1434,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
contentContainerFrame = originalContentFrame.offsetBy(dx: -contentParentNode.contentRect.minX, dy: -overflowOffset - contentParentNode.contentRect.minY)
if contentContainerFrame.maxX > layout.size.width {
contentContainerFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - contentContainerFrame.width) / 2.0), y: contentContainerFrame.minY), size: contentContainerFrame.size)
contentContainerFrame = CGRect(origin: CGPoint(x: layout.size.width - contentContainerFrame.width - 11.0, y: contentContainerFrame.minY), size: contentContainerFrame.size)
}
}

View File

@ -245,7 +245,11 @@ final class GroupVideoNode: ASDisplayNode {
let fittedSize = rotatedVideoSize.aspectFitted(containerSize)
let filledSize = rotatedVideoSize.aspectFilled(containerSize)
let filledToSquareSize = rotatedVideoSize.aspectFilled(CGSize(width: size.height, height: size.height))
var squareSide = size.height
if !size.height.isZero && size.width / size.height < 1.2 {
squareSide = max(size.width, size.height)
}
let filledToSquareSize = rotatedVideoSize.aspectFilled(CGSize(width: squareSide, height: squareSide))
switch layoutMode {
case .fillOrFitToSquare:

View File

@ -491,7 +491,7 @@ public final class VoiceChatController: ViewController {
text = .text(about, textIcon, .generic)
}
return VoiceChatTileItem(account: context.account, peer: peerEntry.peer, videoEndpointId: videoEndpointId, videoReady: videoReady, videoTimeouted: videoTimeouted, isPaused: videoIsPaused, isOwnScreencast: peerEntry.presentationEndpointId == videoEndpointId && peerEntry.isMyPeer, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder, speaking: speaking, secondary: secondary, isTablet: isTablet, icon: showAsPresentation ? .presentation : icon, text: text, additionalText: additionalText, action: {
return VoiceChatTileItem(account: context.account, peer: peerEntry.peer, videoEndpointId: videoEndpointId, videoReady: videoReady, videoTimeouted: videoTimeouted, isVideoLimit: false, isPaused: videoIsPaused, isOwnScreencast: peerEntry.presentationEndpointId == videoEndpointId && peerEntry.isMyPeer, strings: presentationData.strings, nameDisplayOrder: presentationData.nameDisplayOrder, speaking: speaking, secondary: secondary, isTablet: isTablet, icon: showAsPresentation ? .presentation : icon, text: text, additionalText: additionalText, action: {
interaction.switchToPeer(peer.id, videoEndpointId, !secondary)
}, contextAction: { node, gesture in
interaction.peerContextAction(peerEntry, node, gesture, false)
@ -3647,8 +3647,8 @@ public final class VoiceChatController: ViewController {
videoContainerFrame = CGRect(origin: CGPoint(x: 0.0, y: videoTopEdgeY), size: CGSize(width: contentLeftInset, height: layout.size.height))
} else {
let videoTopEdgeY = isLandscape ? 0.0 : layoutTopInset
let videoBottomEdgeY = self.isLandscape ? layout.size.height : layout.size.height - layout.intrinsicInsets.bottom - 84.0
videoFrame = CGRect(x: 0.0, y: videoTopEdgeY, width: isLandscape ? max(0.0, layout.size.width - layout.safeInsets.right - 84.0) : layout.size.width, height: videoBottomEdgeY - videoTopEdgeY)
let videoBottomEdgeY = self.isLandscape ? layout.size.height : layout.size.height - layout.intrinsicInsets.bottom - 92.0
videoFrame = CGRect(x: 0.0, y: videoTopEdgeY, width: isLandscape ? max(0.0, layout.size.width - layout.safeInsets.right - 92.0) : layout.size.width, height: videoBottomEdgeY - videoTopEdgeY)
videoContainerFrame = CGRect(origin: CGPoint(), size: layout.size)
}
transition.updateFrame(node: self.mainStageContainerNode, frame: videoContainerFrame)
@ -3656,7 +3656,7 @@ public final class VoiceChatController: ViewController {
if !self.mainStageNode.animating {
transition.updateFrame(node: self.mainStageNode, frame: videoFrame)
}
self.mainStageNode.update(size: videoFrame.size, sideInset: layout.safeInsets.left, bottomInset: bottomInset, isLandscape: videoFrame.width > videoFrame.height, isTablet: isTablet, transition: transition)
self.mainStageNode.update(size: videoFrame.size, sideInset: layout.safeInsets.left, bottomInset: self.isLandscape ? 0.0 : bottomInset, isLandscape: videoFrame.width > videoFrame.height, isTablet: isTablet, transition: transition)
let backgroundFrame = CGRect(origin: CGPoint(x: 0.0, y: topPanelFrame.maxY), size: CGSize(width: size.width, height: layout.size.height))
@ -4140,12 +4140,12 @@ public final class VoiceChatController: ViewController {
fullscreenListWidth = layout.size.height
fullscreenListTransform = CATransform3DIdentity
fullscreenListUpdateSizeAndInsets = ListViewUpdateSizeAndInsets(size: CGSize(width: fullscreenListHeight, height: layout.size.height), insets: UIEdgeInsets(top: fullscreenListInset, left: 0.0, bottom: fullscreenListInset, right: 0.0), duration: duration, curve: curve)
fullscreenListContainerFrame = CGRect(x: layout.size.width - min(self.effectiveBottomAreaHeight, fullscreenBottomAreaHeight) - layout.safeInsets.right - fullscreenListHeight, y: 0.0, width: fullscreenListHeight, height: layout.size.height)
fullscreenListContainerFrame = CGRect(x: layout.size.width - min(self.effectiveBottomAreaHeight, fullscreenBottomAreaHeight) - layout.safeInsets.right - fullscreenListHeight - 4.0, y: 0.0, width: fullscreenListHeight, height: layout.size.height)
} else {
fullscreenListWidth = layout.size.width
fullscreenListTransform = CATransform3DMakeRotation(-CGFloat(CGFloat.pi / 2.0), 0.0, 0.0, 1.0)
fullscreenListUpdateSizeAndInsets = ListViewUpdateSizeAndInsets(size: CGSize(width: fullscreenListHeight, height: layout.size.width), insets: UIEdgeInsets(top: fullscreenListInset + layout.safeInsets.left, left: 0.0, bottom: fullscreenListInset + layout.safeInsets.left, right: 0.0), duration: duration, curve: curve)
fullscreenListContainerFrame = CGRect(x: 0.0, y: layout.size.height - min(bottomPanelHeight, fullscreenBottomAreaHeight + layout.intrinsicInsets.bottom) - fullscreenListHeight + 4.0, width: layout.size.width, height: fullscreenListHeight)
fullscreenListContainerFrame = CGRect(x: 0.0, y: layout.size.height - min(bottomPanelHeight, fullscreenBottomAreaHeight + layout.intrinsicInsets.bottom) - fullscreenListHeight - 4.0, width: layout.size.width, height: fullscreenListHeight)
}
transition.updateFrame(node: self.fullscreenListContainer, frame: fullscreenListContainerFrame)
@ -5310,6 +5310,11 @@ public final class VoiceChatController: ViewController {
let bottomPanelLocation = gestureRecognizer.location(in: self.bottomPanelNode.view)
let containerLocation = gestureRecognizer.location(in: self.contentContainer.view)
let mainStageLocation = gestureRecognizer.location(in: self.mainStageNode.view)
if self.isLandscape && self.mainStageContainerNode.isUserInteractionEnabled && mainStageLocation.x > self.mainStageNode.frame.width - 80.0 {
return false
}
if self.audioButton.frame.contains(bottomPanelLocation) || (!self.cameraButton.isHidden && self.cameraButton.frame.contains(bottomPanelLocation)) || self.leaveButton.frame.contains(bottomPanelLocation) || self.pickerView?.frame.contains(containerLocation) == true || (self.mainStageContainerNode.isUserInteractionEnabled && (mainStageLocation.y < 44.0 || mainStageLocation.y > self.mainStageNode.frame.height - 100.0)) {
return false
}

View File

@ -524,7 +524,8 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
}
} else {
if currentItem?.peer.id == item.peer.id {
currentVideoNode.layer.animateScale(from: 1.0, to: 0.0, duration: appearanceDuration, completion: { [weak self, weak currentVideoNode] _ in
currentVideoNode.layer.animateScale(from: 1.0, to: 0.0, duration: appearanceDuration, removeOnCompletion: false, completion: { [weak self, weak currentVideoNode] _ in
currentVideoNode?.layer.removeAllAnimations()
if currentVideoNode !== self?.videoNode {
currentVideoNode?.removeFromSupernode()
}
@ -871,7 +872,9 @@ class VoiceChatFullscreenParticipantItemNode: ItemListRevealOptionsItemNode {
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: appearanceDuration, additive: true)
}
if videoNode.supernode === strongSelf.videoContainerNode {
apperanceTransition.updateAlpha(node: videoNode, alpha: 1.0)
}
apperanceTransition.updateAlpha(node: strongSelf.videoFadeNode, alpha: 1.0)
apperanceTransition.updateAlpha(node: strongSelf.avatarNode, alpha: 0.0)
if let audioLevelView = strongSelf.audioLevelView {

View File

@ -1091,10 +1091,6 @@ final class VoiceChatMainStageNode: ASDisplayNode {
let initialBottomInset = bottomInset
var bottomInset = bottomInset
if !sideInset.isZero {
bottomInset = 14.0
}
let layoutMode: GroupVideoNode.LayoutMode
if case .immediate = transition, self.animatingIn {
layoutMode = .fillOrFitToSquare

View File

@ -28,6 +28,7 @@ final class VoiceChatTileItem: Equatable {
let videoEndpointId: String
let videoReady: Bool
let videoTimeouted: Bool
let isVideoLimit: Bool
let isPaused: Bool
let isOwnScreencast: Bool
let strings: PresentationStrings
@ -47,12 +48,13 @@ final class VoiceChatTileItem: Equatable {
return self.videoEndpointId
}
init(account: Account, peer: Peer, videoEndpointId: String, videoReady: Bool, videoTimeouted: Bool, isPaused: Bool, isOwnScreencast: Bool, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, speaking: Bool, secondary: Bool, isTablet: Bool, icon: Icon, text: VoiceChatParticipantItem.ParticipantText, additionalText: VoiceChatParticipantItem.ParticipantText?, action: @escaping () -> Void, contextAction: ((ASDisplayNode, ContextGesture?) -> Void)?, getVideo: @escaping (GroupVideoNode.Position) -> GroupVideoNode?, getAudioLevel: (() -> Signal<Float, NoError>)?) {
init(account: Account, peer: Peer, videoEndpointId: String, videoReady: Bool, videoTimeouted: Bool, isVideoLimit: Bool, isPaused: Bool, isOwnScreencast: Bool, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, speaking: Bool, secondary: Bool, isTablet: Bool, icon: Icon, text: VoiceChatParticipantItem.ParticipantText, additionalText: VoiceChatParticipantItem.ParticipantText?, action: @escaping () -> Void, contextAction: ((ASDisplayNode, ContextGesture?) -> Void)?, getVideo: @escaping (GroupVideoNode.Position) -> GroupVideoNode?, getAudioLevel: (() -> Signal<Float, NoError>)?) {
self.account = account
self.peer = peer
self.videoEndpointId = videoEndpointId
self.videoReady = videoReady
self.videoTimeouted = videoTimeouted
self.isVideoLimit = isVideoLimit
self.isPaused = isPaused
self.isOwnScreencast = isOwnScreencast
self.strings = strings

View File

@ -7,6 +7,8 @@ import SyncCore
public enum ServerProvidedSuggestion: String {
case autoarchivePopular = "AUTOARCHIVE_POPULAR"
case newcomerTicks = "NEWCOMER_TICKS"
case validatePhoneNumber = "VALIDATE_PHONE_NUMBER"
case validatePassword = "VALIDATE_PASSWORD"
}
public func getServerProvidedSuggestions(postbox: Postbox) -> Signal<[ServerProvidedSuggestion], NoError> {