From a2c624c3b34a71c081c32d0453fdd6b9e2e186c9 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Thu, 3 Apr 2025 19:33:12 +0400 Subject: [PATCH] Conference improvements --- .../Sources/CallListController.swift | 38 ++++++++++++++++++- .../Sources/PresentationGroupCall.swift | 5 --- .../Sources/VideoChatScreen.swift | 12 +++++- .../ChatMessageWebpageBubbleContentNode.swift | 3 ++ 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/submodules/CallListUI/Sources/CallListController.swift b/submodules/CallListUI/Sources/CallListController.swift index ad70beba8c..d8df9577a9 100644 --- a/submodules/CallListUI/Sources/CallListController.swift +++ b/submodules/CallListUI/Sources/CallListController.swift @@ -209,13 +209,49 @@ public final class CallListController: TelegramBaseController { } private func createGroupCall() { + self.view.endEditing(true) + guard !self.presentAccountFrozenInfoIfNeeded() else { return } if self.createConferenceCallDisposable != nil { return } - self.createConferenceCallDisposable = (self.context.engine.calls.createConferenceCall() + + var cancelImpl: (() -> Void)? + var signal = self.context.engine.calls.createConferenceCall() + let presentationData = self.context.sharedContext.currentPresentationData.with { $0 } + let progressSignal = Signal { [weak self] subscriber in + let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: { + cancelImpl?() + })) + self?.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + return ActionDisposable { [weak controller] in + Queue.mainQueue().async() { + controller?.dismiss() + } + } + } + |> runOn(Queue.mainQueue()) + |> delay(0.3, queue: Queue.mainQueue()) + let progressDisposable = progressSignal.start() + + signal = signal + |> afterDisposed { + Queue.mainQueue().async { + progressDisposable.dispose() + } + } + cancelImpl = { [weak self] in + guard let self else { + return + } + self.createConferenceCallDisposable?.dispose() + self.createConferenceCallDisposable = nil + } + + self.createConferenceCallDisposable?.dispose() + self.createConferenceCallDisposable = (signal |> deliverOnMainQueue).startStrict(next: { [weak self] call in guard let self else { return diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index fad8fa26b8..8082cf4f22 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -2117,11 +2117,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } var prioritizeVP8 = false - #if DEBUG - if "".isEmpty { - prioritizeVP8 = true - } - #endif if let data = self.accountContext.currentAppConfiguration.with({ $0 }).data, let value = data["ios_calls_prioritize_vp8"] as? Double { prioritizeVP8 = value != 0.0 } diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift index 6e89966067..658e2beaa0 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift @@ -2429,16 +2429,24 @@ final class VideoChatScreenComponent: Component { var encryptionKeyTransition = transition if encryptionKeyView.superview == nil { encryptionKeyTransition = encryptionKeyTransition.withAnimation(.none) - self.containerView.addSubview(encryptionKeyView) + + if let participantsView = self.participants.view as? VideoChatParticipantsComponent.View { + self.containerView.insertSubview(encryptionKeyView, belowSubview: participantsView) + } else { + self.containerView.addSubview(encryptionKeyView) + } ComponentTransition.immediate.setScale(view: encryptionKeyView, scale: 0.001) encryptionKeyView.alpha = 0.0 } + encryptionKeyTransition.setPosition(view: encryptionKeyView, position: encryptionKeyFrame.center) encryptionKeyTransition.setBounds(view: encryptionKeyView, bounds: CGRect(origin: CGPoint(), size: encryptionKeyFrame.size)) transition.setScale(view: encryptionKeyView, scale: 1.0) alphaTransition.setAlpha(view: encryptionKeyView, alpha: self.isAnimatedOutFromPrivateCall ? 0.0 : 1.0) + transition.setZPosition(layer: encryptionKeyView.layer, zPosition: self.isEncryptionKeyExpanded ? 1.0 : 0.0) + if self.isEncryptionKeyExpanded { let encryptionKeyBackground: ComponentView var encryptionKeyBackgroundTransition = transition @@ -2464,12 +2472,14 @@ final class VideoChatScreenComponent: Component { self.containerView.insertSubview(encryptionKeyBackgroundView, belowSubview: encryptionKeyView) encryptionKeyBackgroundView.alpha = 0.0 } + encryptionKeyBackgroundView.layer.zPosition = 0.9 alphaTransition.setAlpha(view: encryptionKeyBackgroundView, alpha: 1.0) encryptionKeyBackgroundTransition.setFrame(view: encryptionKeyBackgroundView, frame: CGRect(origin: CGPoint(), size: availableSize)) } } else if let encryptionKeyBackground = self.encryptionKeyBackground { self.encryptionKeyBackground = nil if let encryptionKeyBackgroundView = encryptionKeyBackground.view { + transition.setZPosition(layer: encryptionKeyBackgroundView.layer, zPosition: 0.0) alphaTransition.setAlpha(view: encryptionKeyBackgroundView, alpha: 0.0, completion: { [weak encryptionKeyBackgroundView] _ in encryptionKeyBackgroundView?.removeFromSuperview() }) diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageWebpageBubbleContentNode/Sources/ChatMessageWebpageBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageWebpageBubbleContentNode/Sources/ChatMessageWebpageBubbleContentNode.swift index 123fb0445c..bc905b9149 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageWebpageBubbleContentNode/Sources/ChatMessageWebpageBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageWebpageBubbleContentNode/Sources/ChatMessageWebpageBubbleContentNode.swift @@ -474,6 +474,9 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent actionTitle = item.presentationData.strings.Conversation_ViewStarGift text = nil entities = nil + case "telegram_call": + //TODO:localize + actionTitle = "JOIN GROUP CALL" default: break }