From 09576bb3913e7c61187923c8d3e9ff0dba0976cb Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 25 Apr 2021 23:08:18 +0400 Subject: [PATCH] Temp --- .../Source/ContextContentSourceNode.swift | 17 +++++++++++++++++ .../Sources/PresentationGroupCall.swift | 3 +++ .../Sources/ChatMessageBubbleItemNode.swift | 15 +++++++++++++-- .../TelegramVoip/Sources/GroupCallContext.swift | 10 ++++++++++ submodules/TgVoipWebrtc/BUILD | 3 +++ .../OngoingCallThreadLocalContext.h | 1 + .../Sources/OngoingCallThreadLocalContext.mm | 6 ++++++ submodules/TgVoipWebrtc/tgcalls | 2 +- 8 files changed, 54 insertions(+), 3 deletions(-) diff --git a/submodules/Display/Source/ContextContentSourceNode.swift b/submodules/Display/Source/ContextContentSourceNode.swift index ffd7ab165e..5eb8d82223 100644 --- a/submodules/Display/Source/ContextContentSourceNode.swift +++ b/submodules/Display/Source/ContextContentSourceNode.swift @@ -24,10 +24,27 @@ public final class ContextExtractedContentContainingNode: ASDisplayNode { self.addSubnode(self.contentNode) } + + public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + if self.contentNode.supernode === self { + return self.contentNode.hitTest(self.view.convert(point, to: self.contentNode.view), with: event) + } else { + return nil + } + } } public final class ContextExtractedContentNode: ASDisplayNode { public var customHitTest: ((CGPoint) -> UIView?)? + + public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + let result = self.view.hitTest(point, with: event) + if result === self.view { + return nil + } else { + return result + } + } } public final class ContextControllerContentNode: ASDisplayNode { diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index 2be2255adb..3205fdc669 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -1852,6 +1852,9 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } else if participant.muteState?.mutedByYou == true { strongSelf.callContext?.setVolume(ssrc: ssrc, volume: 0.0) } + if participant.isVideoMuted { + strongSelf.callContext?.removeIncomingVideoSource(ssrc) + } } } diff --git a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift index b627e0a544..0abb7cf070 100644 --- a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift @@ -35,6 +35,17 @@ private struct BubbleItemAttributes { var neighborSpacing: ChatMessageBubbleRelativePosition.NeighbourSpacing } +private final class ChatMessageBubbleClippingNode: ASDisplayNode { + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + let result = self.view.hitTest(point, with: event) + if result === self.view { + return nil + } else { + return result + } + } +} + private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([(Message, AnyClass, ChatMessageEntryAttributes, BubbleItemAttributes)], Bool) { var result: [(Message, AnyClass, ChatMessageEntryAttributes, BubbleItemAttributes)] = [] var skipText = false @@ -367,7 +378,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode private let backgroundWallpaperNode: ChatMessageBubbleBackdrop private let backgroundNode: ChatMessageBackground private let shadowNode: ChatMessageShadowNode - private var clippingNode: ASDisplayNode + private var clippingNode: ChatMessageBubbleClippingNode override var extractedBackgroundNode: ASDisplayNode? { return self.shadowNode @@ -431,7 +442,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode self.backgroundNode = ChatMessageBackground() self.shadowNode = ChatMessageShadowNode() - self.clippingNode = ASDisplayNode() + self.clippingNode = ChatMessageBubbleClippingNode() self.clippingNode.clipsToBounds = true self.messageAccessibilityArea = AccessibilityAreaNode() diff --git a/submodules/TelegramVoip/Sources/GroupCallContext.swift b/submodules/TelegramVoip/Sources/GroupCallContext.swift index 8beb545dc0..2799c070d0 100644 --- a/submodules/TelegramVoip/Sources/GroupCallContext.swift +++ b/submodules/TelegramVoip/Sources/GroupCallContext.swift @@ -288,6 +288,10 @@ public final class OngoingGroupCallContext { return ssrc as NSNumber }) } + + func removeIncomingVideoSource(_ ssrc: UInt32) { + self.context.removeIncomingVideoSource(ssrc) + } func setVolume(ssrc: UInt32, volume: Double) { self.context.setVolumeForSsrc(ssrc, volume: volume) @@ -593,6 +597,12 @@ public final class OngoingGroupCallContext { impl.removeSsrcs(ssrcs: ssrcs) } } + + public func removeIncomingVideoSource(_ ssrc: UInt32) { + self.impl.with { impl in + impl.removeIncomingVideoSource(ssrc) + } + } public func setVolume(ssrc: UInt32, volume: Double) { self.impl.with { impl in diff --git a/submodules/TgVoipWebrtc/BUILD b/submodules/TgVoipWebrtc/BUILD index eb80e8dcc0..90a4c36cac 100644 --- a/submodules/TgVoipWebrtc/BUILD +++ b/submodules/TgVoipWebrtc/BUILD @@ -20,6 +20,9 @@ objc_library( "tgcalls/tgcalls/platform/darwin/VideoMetalViewMac.*", "tgcalls/tgcalls/platform/darwin/GLVideoViewMac.*", "tgcalls/tgcalls/platform/darwin/ScreenCapturer.*", + "tgcalls/tgcalls/platform/darwin/DesktopSharingCapturer.*", + "tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceViewMac.*", + "tgcalls/tgcalls/platform/darwin/DesktopCaptureSourceView.*", "tgcalls/tgcalls/desktop_capturer/**", ]), hdrs = glob([ diff --git a/submodules/TgVoipWebrtc/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h b/submodules/TgVoipWebrtc/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h index 7a5856d170..635939628f 100644 --- a/submodules/TgVoipWebrtc/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h +++ b/submodules/TgVoipWebrtc/PublicHeaders/TgVoipWebrtc/OngoingCallThreadLocalContext.h @@ -205,6 +205,7 @@ typedef NS_ENUM(int32_t, OngoingGroupCallBroadcastPartStatus) { - (void)emitJoinPayload:(void (^ _Nonnull)(NSString * _Nonnull, uint32_t))completion; - (void)setJoinResponsePayload:(NSString * _Nonnull)payload participants:(NSArray * _Nonnull)participants; - (void)removeSsrcs:(NSArray * _Nonnull)ssrcs; +- (void)removeIncomingVideoSource:(uint32_t)ssrc; - (void)addParticipants:(NSArray * _Nonnull)participants; - (void)setIsMuted:(bool)isMuted; - (void)setIsNoiseSuppressionEnabled:(bool)isNoiseSuppressionEnabled; diff --git a/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm b/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm index 0496174e33..175a4a16ef 100644 --- a/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm +++ b/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm @@ -1272,6 +1272,12 @@ static void processJoinPayload(tgcalls::GroupJoinPayload &payload, void (^ _Nonn } } +- (void)removeIncomingVideoSource:(uint32_t)ssrc { + if (_instance) { + _instance->removeIncomingVideoSource(ssrc); + } +} + - (void)parseJsonIntoParticipant:(NSString *)payload participant:(tgcalls::GroupParticipantDescription &)participant { NSData *payloadData = [payload dataUsingEncoding:NSUTF8StringEncoding]; if (payloadData == nil) { diff --git a/submodules/TgVoipWebrtc/tgcalls b/submodules/TgVoipWebrtc/tgcalls index e83f57813e..5f5f3a2636 160000 --- a/submodules/TgVoipWebrtc/tgcalls +++ b/submodules/TgVoipWebrtc/tgcalls @@ -1 +1 @@ -Subproject commit e83f57813e0dd4b7abb2772f98c86ddf0ed47638 +Subproject commit 5f5f3a263602841e953faec56edb45cad492241b