diff --git a/submodules/AccountContext/Sources/PresentationCallManager.swift b/submodules/AccountContext/Sources/PresentationCallManager.swift index a3e544a066..15d556e73e 100644 --- a/submodules/AccountContext/Sources/PresentationCallManager.swift +++ b/submodules/AccountContext/Sources/PresentationCallManager.swift @@ -206,6 +206,8 @@ public protocol PresentationGroupCall: class { func toggleIsMuted() func setIsMuted(_ value: Bool) func setCurrentAudioOutput(_ output: AudioSessionOutput) + + func invitePeer(_ peerId: PeerId) } public protocol PresentationCallManager: class { diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index cc9212a9cb..d4dd35fa46 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -552,4 +552,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { strongSelf.updateSessionState(internalState: .active(value), audioSessionControl: strongSelf.audioSessionControl) })) } + + public func invitePeer(_ peerId: PeerId) { + guard case let .estabilished(callInfo, _, _, _, _) = self.internalState else { + return + } + + let _ = inviteToGroupCall(account: self.account, callId: callInfo.id, accessHash: callInfo.accessHash, peerId: peerId).start() + } } diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift index af8f5ec34d..a5766e7e78 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift @@ -88,11 +88,11 @@ private final class Blob { } } - var currentShape: CGPath? + var currentShape: UIBezierPath? private var transition: CGFloat = 0 { didSet { if let currentPoints = self.currentPoints { - self.currentShape = UIBezierPath.smoothCurve(through: currentPoints, length: size.width, smoothness: smoothness).cgPath + self.currentShape = UIBezierPath.smoothCurve(through: currentPoints, length: size.width, smoothness: smoothness) } } } @@ -450,7 +450,6 @@ private class VoiceChatActionButtonBackgroundNode: ASDisplayNode { let buttonSize = CGSize(width: 144.0, height: 144.0) let radius = buttonSize.width / 2.0 - let blue = UIColor(rgb: 0x0078ff) let lightBlue = UIColor(rgb: 0x59c7f8) let green = UIColor(rgb: 0x33c659) @@ -512,7 +511,7 @@ private class VoiceChatActionButtonBackgroundNode: ASDisplayNode { if let blobsState = parameters.state as? VoiceChatActionButtonBackgroundNodeBlobState { for blob in blobsState.blobs { if let path = blob.currentShape { - let uiPath = UIBezierPath(cgPath: path) + let uiPath = path let toOrigin = CGAffineTransform(translationX: -bounds.size.width / 2.0, y: -bounds.size.height / 2.0) let fromOrigin = CGAffineTransform(translationX: bounds.size.width / 2.0, y: bounds.size.height / 2.0) diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index c7325cb324..9d95ee805f 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -273,6 +273,8 @@ public final class VoiceChatController: ViewController { ), in: .current ) + + strongSelf.call.invitePeer(peer.id) }, peerContextAction: { [weak self] peer, sourceNode, gesture in guard let strongSelf = self, let controller = strongSelf.controller, let sourceNode = sourceNode as? ContextExtractedContentContainingNode else { return @@ -639,6 +641,7 @@ public final class VoiceChatController: ViewController { let actionButtonTitle: String let actionButtonSubtitle: String let audioButtonAppearance: CallControllerButtonItemNode.Content.Appearance + var actionButtonEnabled = true if let callState = callState { isMicOn = !callState.isMuted @@ -648,6 +651,7 @@ public final class VoiceChatController: ViewController { actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting actionButtonSubtitle = "" audioButtonAppearance = .color(.custom(0x1c1c1e)) + actionButtonEnabled = false case .connected: actionButtonState = .active(state: isMicOn ? .on : .muted) if isMicOn { @@ -665,8 +669,10 @@ public final class VoiceChatController: ViewController { actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting actionButtonSubtitle = "" audioButtonAppearance = .color(.custom(0x1c1c1e)) + actionButtonEnabled = false } + self.actionButton.isUserInteractionEnabled = actionButtonEnabled self.actionButton.update(size: centralButtonSize, buttonSize: CGSize(width: 144.0, height: 144.0), state: actionButtonState, title: actionButtonTitle, subtitle: actionButtonSubtitle, animated: true) transition.updateFrame(node: self.actionButton, frame: actionButtonFrame) @@ -703,7 +709,7 @@ public final class VoiceChatController: ViewController { soundImage = .speaker case .speaker: soundImage = .speaker -// soundAppearance = .blurred(isFilled: false) + soundAppearance = .blurred(isFilled: true) case .headphones: soundImage = .bluetooth case let .bluetooth(type): diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift index f89f08cc08..ef8167540f 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift @@ -345,8 +345,8 @@ public class VoiceChatParticipantItemNode: ListViewItemNode { let verticalOffset: CGFloat = 0.0 let avatarSize: CGFloat = 40.0 - let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets())) - let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets())) + let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - rightInset - 25.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets())) + let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - rightInset - 25.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets())) let insets = UIEdgeInsets()