From 157692bc48059a4712c13c26cbeaf959ae1558b2 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Fri, 4 Apr 2025 22:17:28 +0400 Subject: [PATCH] Conference update --- .../Sources/PresentationCall.swift | 2 + .../Sources/PresentationCallManager.swift | 4 - .../VideoChatParticipantStatusComponent.swift | 72 ++++++++++++++++++ .../VideoChatParticipantsComponent.swift | 8 +- ...ideoChatScreenParticipantContextMenu.swift | 25 +++--- .../Sources/PeerListItemComponent.swift | 11 ++- .../GroupPeerInvited.imageset/Contents.json | 12 +++ .../GroupPeerInvited.imageset/invited.pdf | Bin 0 -> 4354 bytes submodules/TgVoipWebrtc/tgcalls | 2 +- 9 files changed, 117 insertions(+), 19 deletions(-) create mode 100644 submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json create mode 100644 submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/invited.pdf diff --git a/submodules/TelegramCallsUI/Sources/PresentationCall.swift b/submodules/TelegramCallsUI/Sources/PresentationCall.swift index 10a083f8b3..46dc2b77c9 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCall.swift @@ -658,6 +658,8 @@ public final class PresentationCallImpl: PresentationCall { self.sharedAudioContext = nil self.sessionState = nil self.callContextState = nil + let debugLogValue = Promise() + self.ongoingContext?.stop(sendDebugLogs: false, debugLogValue: debugLogValue) self.ongoingContext = nil self.ongoingContextStateDisposable?.dispose() self.ongoingContextStateDisposable = nil diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index 7d3b79b3fd..e7b6433db6 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -973,10 +973,6 @@ public final class PresentationCallManagerImpl: PresentationCallManager { return .joined } - public func switchToConference(call: PresentationCall) { - - } - private func startGroupCall( accountContext: AccountContext, peerId: PeerId, diff --git a/submodules/TelegramCallsUI/Sources/VideoChatParticipantStatusComponent.swift b/submodules/TelegramCallsUI/Sources/VideoChatParticipantStatusComponent.swift index 5b480bac46..eb875e466f 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatParticipantStatusComponent.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatParticipantStatusComponent.swift @@ -5,6 +5,7 @@ import ComponentFlow import TelegramPresentationData import TelegramCore import LottieComponent +import BundleIconComponent final class VideoChatParticipantStatusComponent: Component { let muteState: GroupCallParticipantsContext.Participant.MuteState? @@ -222,3 +223,74 @@ final class VideoChatParticipantStatusComponent: Component { return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition) } } + +final class VideoChatParticipantInvitedStatusComponent: Component { + let theme: PresentationTheme + + init(theme: PresentationTheme) { + self.theme = theme + } + + static func ==(lhs: VideoChatParticipantInvitedStatusComponent, rhs: VideoChatParticipantInvitedStatusComponent) -> Bool { + if lhs.theme !== rhs.theme { + return false + } + return true + } + + final class View: UIView { + private var icon = ComponentView() + + private var component: VideoChatParticipantInvitedStatusComponent? + private var isUpdating: Bool = false + + override init(frame: CGRect) { + super.init(frame: frame) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + } + + func update(component: VideoChatParticipantInvitedStatusComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize { + self.isUpdating = true + defer { + self.isUpdating = false + } + + let size = CGSize(width: 44.0, height: 44.0) + + let iconTintColor = UIColor(white: 1.0, alpha: 0.4) + let iconSize = self.icon.update( + transition: transition, + component: AnyComponent(BundleIconComponent( + name: "Call/GroupPeerInvited", + tintColor: iconTintColor + )), + environment: {}, + containerSize: size + ) + + let iconFrame = CGRect(origin: CGPoint(x: floor((size.width - iconSize.width) * 0.5) - 2.0, y: floor((size.height - iconSize.height) * 0.5)), size: iconSize) + if let iconView = self.icon.view { + if iconView.superview == nil { + self.addSubview(iconView) + } + transition.setFrame(view: iconView, frame: iconFrame) + } + + return size + } + } + + func makeView() -> View { + return View() + } + + func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize { + return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition) + } +} diff --git a/submodules/TelegramCallsUI/Sources/VideoChatParticipantsComponent.swift b/submodules/TelegramCallsUI/Sources/VideoChatParticipantsComponent.swift index 879ebc665e..5f975d1a73 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatParticipantsComponent.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatParticipantsComponent.swift @@ -1258,7 +1258,7 @@ final class VideoChatParticipantsComponent: Component { subtitle: subtitle, subtitleAccessory: .none, presence: nil, - rightAccessoryComponent: rightAccessoryComponent, + rightAccessoryComponent: AnyComponentWithIdentity(id: 0, component: rightAccessoryComponent), selectionState: .none, hasNext: false, extractedTheme: PeerListItemComponent.ExtractedTheme( @@ -1295,6 +1295,10 @@ final class VideoChatParticipantsComponent: Component { subtitle = PeerListItemComponent.Subtitle(text: "invited", color: .neutral) } + let rightAccessoryComponent: AnyComponent = AnyComponent(VideoChatParticipantInvitedStatusComponent( + theme: component.theme + )) + peerItemComponent = PeerListItemComponent( context: component.call.accountContext, theme: component.theme, @@ -1313,7 +1317,7 @@ final class VideoChatParticipantsComponent: Component { subtitle: subtitle, subtitleAccessory: .none, presence: nil, - rightAccessoryComponent: nil, + rightAccessoryComponent: AnyComponentWithIdentity(id: 1, component: rightAccessoryComponent), selectionState: .none, hasNext: false, extractedTheme: PeerListItemComponent.ExtractedTheme( diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift index 0161d1a73d..9cbef0c378 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatScreenParticipantContextMenu.swift @@ -271,11 +271,17 @@ extension VideoChatScreenComponent.View { guard let self, case let .group(groupCall) = self.currentCall else { return } - guard let peerId = groupCall.peerId else { - return + + let chatPeer: Signal + if let peerId = groupCall.peerId { + chatPeer = groupCall.accountContext.engine.data.get( + TelegramEngine.EngineData.Item.Peer.Peer(id: peerId) + ) + } else { + chatPeer = .single(nil) } - let _ = (groupCall.accountContext.account.postbox.loadedPeerWithId(peerId) + let _ = (chatPeer |> deliverOnMainQueue).start(next: { [weak self] chatPeer in guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else { return @@ -286,7 +292,9 @@ extension VideoChatScreenComponent.View { var items: [ActionSheetItem] = [] let nameDisplayOrder = presentationData.nameDisplayOrder - items.append(DeleteChatPeerActionSheetItem(context: groupCall.accountContext, peer: EnginePeer(peer), chatPeer: EnginePeer(chatPeer), action: .removeFromGroup, strings: environment.strings, nameDisplayOrder: nameDisplayOrder)) + if let chatPeer { + items.append(DeleteChatPeerActionSheetItem(context: groupCall.accountContext, peer: EnginePeer(peer), chatPeer: chatPeer, action: .removeFromGroup, strings: environment.strings, nameDisplayOrder: nameDisplayOrder)) + } items.append(ActionSheetButtonItem(title: environment.strings.VoiceChat_RemovePeerRemove, color: .destructive, action: { [weak self, weak actionSheet] in actionSheet?.dismissAnimated() @@ -294,15 +302,14 @@ extension VideoChatScreenComponent.View { guard let self, let environment = self.environment, case let .group(groupCall) = self.currentCall else { return } - guard let callPeerId = groupCall.peerId else { - return - } - let _ = groupCall.accountContext.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: groupCall.accountContext.engine, peerId: callPeerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start() if groupCall.isConference { groupCall.kickPeer(id: peer.id) } else { - groupCall.removedPeer(peer.id) + if let callPeerId = groupCall.peerId { + let _ = groupCall.accountContext.peerChannelMemberCategoriesContextsManager.updateMemberBannedRights(engine: groupCall.accountContext.engine, peerId: callPeerId, memberId: peer.id, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: Int32.max)).start() + groupCall.removedPeer(peer.id) + } } self.presentUndoOverlay(content: .banned(text: environment.strings.VoiceChat_RemovedPeerText(EnginePeer(peer).displayTitle(strings: environment.strings, displayOrder: nameDisplayOrder)).string), action: { _ in return false }) diff --git a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift index 391095f941..8408cee489 100644 --- a/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift +++ b/submodules/TelegramUI/Components/Stories/PeerListItemComponent/Sources/PeerListItemComponent.swift @@ -235,7 +235,7 @@ public final class PeerListItemComponent: Component { let subtitleAccessory: SubtitleAccessory let presence: EnginePeer.Presence? let rightAccessory: RightAccessory - let rightAccessoryComponent: AnyComponent? + let rightAccessoryComponent: AnyComponentWithIdentity? let reaction: Reaction? let story: EngineStoryItem? let message: EngineMessage? @@ -266,7 +266,7 @@ public final class PeerListItemComponent: Component { subtitleAccessory: SubtitleAccessory, presence: EnginePeer.Presence?, rightAccessory: RightAccessory = .none, - rightAccessoryComponent: AnyComponent? = nil, + rightAccessoryComponent: AnyComponentWithIdentity? = nil, reaction: Reaction? = nil, story: EngineStoryItem? = nil, message: EngineMessage? = nil, @@ -763,9 +763,14 @@ public final class PeerListItemComponent: Component { height = 40.0 + verticalInset * 2.0 } } + + if let rightAccessoryComponentView = self.rightAccessoryComponentView, component.rightAccessoryComponent?.id != previousComponent?.rightAccessoryComponent?.id { + self.rightAccessoryComponentView = nil + rightAccessoryComponentView.view?.removeFromSuperview() + } var rightAccessoryComponentSize: CGSize? - if let rightAccessoryComponent = component.rightAccessoryComponent { + if let rightAccessoryComponent = component.rightAccessoryComponent?.component { var rightAccessoryComponentTransition = transition let rightAccessoryComponentView: ComponentView if let current = self.rightAccessoryComponentView { diff --git a/submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json new file mode 100644 index 0000000000..95e165d835 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "invited.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/invited.pdf b/submodules/TelegramUI/Images.xcassets/Call/GroupPeerInvited.imageset/invited.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f6871e70f3c997443f4bb732ed06ec049076596d GIT binary patch literal 4354 zcmai2c{tQ<_cs_cS(1ILu_fym3{}DB>8YN#_xWAd@BU-vT%Y@#&-Xs(d)?>yoUb54Q(GJ=AqN6M!IEIKoeKyI zR#E~()Z8#gZx34x5)9Eq`l0NRCKuI@w~iM?8%5eX{&zdx)b68tH1`eXLDyd$y%4+>35??Rdv`8RBg0yG_%d3GsJ^oGN|>NrsIZ-Bua{^6Tw zfA*@z*qO9$x^MIt(@w4(*3%ZvM~H9D%vd6=L{%nR`;7VGJDMC-JS!Jxzj_@HnG*a^ zku|uxiTMlzS^E`%5GSIQI8?_hLrj+u+@ItH%1H|Klx;t#)J54vh$6iRL5C=g*!>yG zh(^Y9PM7v{c#LIJc`WQKl!et(It-Y4Ri+`EAt82Pk}YT139j}ONv0hf#XJJb!p%_Ju`+Lkm9wI{+EG03xW^YnaRyho zribMOA_VS(E>XWwg&K>Qf<-_q(Wmod^EQkNOI%DTO6kVJ8^ROw&l#U3n9HyjT$COf za8}s@$*^U`&qYXRrWP3GW)NnV6qgvcm=8pw!U%16+e}F}eadrZk|KLM?%TOQ4e)(< zKtKBj9@f|^&pB;*p4^T7ab9m-Xq{*8CeepTs}_1g)sv6%G&Z6pf=`_;FU~Vo zQX9`Jayl+Xq7z}q=OtQsXF|0}KS(D?gYOcQvM;QI(#NqQST4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J!^VbI@~SME3ZV_5a@Kx2HsmexO~PSd|UkLOl|t<$f;)Bx##vQ#^pEw6$pq0o~+u3?L@bwfM-8H)8r zI)Ws@P)X3=`ICOZvM`u541A3LTu@2y4-4$^6OxjJA0L#o{(FZq9Q zNz2I`*Xs{2X*t>drI&`w{4c$XB=orYKLat|wkS8GH;DA!bv2I*dEN)@juZx;M>z=p qT~3Gz8jS&yO7-K_KrW*KkfgkSe1)*}#{8&+jHH}2NKjDANc%sT5R^Os literal 0 HcmV?d00001 diff --git a/submodules/TgVoipWebrtc/tgcalls b/submodules/TgVoipWebrtc/tgcalls index fd1cfbd815..579cae3c3c 160000 --- a/submodules/TgVoipWebrtc/tgcalls +++ b/submodules/TgVoipWebrtc/tgcalls @@ -1 +1 @@ -Subproject commit fd1cfbd8151b2c32d5471a4f5431faa6274ce421 +Subproject commit 579cae3c3c70c6ed8bc0d88cc41de28bd50a7f1b