From bcc1213db2bca9664dd662d29eef87295a9450b2 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Sat, 18 Oct 2025 02:55:47 +0800 Subject: [PATCH] Update --- .../Sources/PresentationGroupCall.swift | 34 ++++++++++++++----- .../TelegramEngine/Calls/GroupCalls.swift | 7 +++- .../ChatChannelSubscriberInputPanelNode.swift | 9 +++-- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index 4226c26374..bd0c4fcffc 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -930,17 +930,34 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { if let data = accountContext.currentAppConfiguration.with({ $0 }).data, let value = data["group_call_message_ttl"] as? Double { messageLifetime = Int32(value) } + + var createMessageContext = true + if isStream { messageLifetime = Int32.max + + if self.isStream { + createMessageContext = false + if let data = self.accountContext.currentAppConfiguration.with({ $0 }).data { + if let dev = data["dev"] as? Double, dev != 0.0 { + createMessageContext = true + } + if data["ios_can_join_streams"] != nil { + createMessageContext = true + } + } + } + } + if createMessageContext { + self.messagesContext = accountContext.engine.messages.groupCallMessages( + callId: initialCall.description.id, + reference: .id(id: initialCall.description.id, accessHash: initialCall.description.accessHash), + e2eContext: self.e2eContext, + messageLifetime: messageLifetime, + isLiveStream: isStream + ) + self.messagesStatePromise.set(self.messagesContext!.state) } - self.messagesContext = accountContext.engine.messages.groupCallMessages( - callId: initialCall.description.id, - reference: .id(id: initialCall.description.id, accessHash: initialCall.description.accessHash), - e2eContext: self.e2eContext, - messageLifetime: messageLifetime, - isLiveStream: isStream - ) - self.messagesStatePromise.set(self.messagesContext!.state) } var sharedAudioContext = sharedAudioContext @@ -2028,6 +2045,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } self.currentLocalSsrc = ssrc + self.requestDisposable.set((self.accountContext.engine.calls.joinGroupCall( peerId: self.peerId, joinAs: self.joinAsPeerId, diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift index 620a02f241..27fb6ea04f 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift @@ -3891,6 +3891,9 @@ public final class GroupCallMessagesContext { } var state = self.state var existingIds = Set(state.messages.map(\.id)) + + let currentTime = Int32(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970) + for message in messages { if existingIds.contains(message.id) { continue @@ -3898,7 +3901,9 @@ public final class GroupCallMessagesContext { existingIds.insert(message.id) state.messages.append(message) if self.isLiveStream && message.paidStars != nil { - state.pinnedMessages.append(message) + if message.date + message.lifetime >= currentTime { + state.pinnedMessages.append(message) + } } } self.state = state diff --git a/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift b/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift index d5126f3e37..0e394297a6 100644 --- a/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift @@ -200,7 +200,6 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { self.suggestedPostButton = HighlightableButton() self.suggestedPostButtonBackgroundView = GlassBackgroundView() self.suggestedPostButtonBackgroundView.isUserInteractionEnabled = false - self.suggestedPostButton.addSubview(self.suggestedPostButtonBackgroundView) self.suggestedPostButtonIconView = GlassBackgroundView.ContentImageView() self.suggestedPostButtonBackgroundView.contentView.addSubview(self.suggestedPostButtonIconView) self.suggestedPostButtonBackgroundView.contentView.addSubview(self.suggestedPostButton) @@ -479,7 +478,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { } else { buttonTintColor = .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)) } - self.buttonBackgroundView.update(size: buttonFrame.size, cornerRadius: buttonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: buttonTintColor, transition: ComponentTransition(transition)) + self.buttonBackgroundView.update(size: buttonFrame.size, cornerRadius: buttonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: buttonTintColor, isInteractive: true, transition: ComponentTransition(transition)) self.buttonTitle.frame = CGRect(origin: CGPoint(x: floor((buttonFrame.width - buttonTitleSize.width) * 0.5), y: floor((buttonFrame.height - buttonTitleSize.height) * 0.5)), size: buttonTitleSize) self.buttonTintTitle.frame = self.buttonTitle.frame @@ -489,7 +488,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { transition.updateFrame(view: self.giftButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: giftButtonFrame.size))) } transition.updateFrame(view: self.giftButton, frame: CGRect(origin: CGPoint(), size: giftButtonFrame.size)) - self.giftButtonBackgroundView.update(size: giftButtonFrame.size, cornerRadius: giftButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) + self.giftButtonBackgroundView.update(size: giftButtonFrame.size, cornerRadius: giftButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), isInteractive: true, transition: ComponentTransition(transition)) let helpButtonFrame = CGRect(x: width - rightInset - 8.0 - 40.0, y: floor((panelHeight - 40.0) * 0.5), width: 40.0, height: 40.0) transition.updateFrame(view: self.helpButtonBackgroundView, frame: helpButtonFrame) @@ -497,7 +496,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { transition.updateFrame(view: self.helpButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: helpButtonFrame.size))) } transition.updateFrame(view: self.helpButton, frame: CGRect(origin: CGPoint(), size: helpButtonFrame.size)) - self.helpButtonBackgroundView.update(size: helpButtonFrame.size, cornerRadius: helpButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) + self.helpButtonBackgroundView.update(size: helpButtonFrame.size, cornerRadius: helpButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), isInteractive: true, transition: ComponentTransition(transition)) let suggestedPostButtonFrame = CGRect(x: leftInset + 8.0, y: floor((panelHeight - 40.0) * 0.5), width: 40.0, height: 40.0) transition.updateFrame(view: self.suggestedPostButtonBackgroundView, frame: suggestedPostButtonFrame) @@ -505,7 +504,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { transition.updateFrame(view: self.suggestedPostButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: suggestedPostButtonFrame.size))) } transition.updateFrame(view: self.suggestedPostButton, frame: CGRect(origin: CGPoint(), size: suggestedPostButtonFrame.size)) - self.suggestedPostButtonBackgroundView.update(size: suggestedPostButtonFrame.size, cornerRadius: suggestedPostButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) + self.suggestedPostButtonBackgroundView.update(size: suggestedPostButtonFrame.size, cornerRadius: suggestedPostButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), isInteractive: true, transition: ComponentTransition(transition)) return panelHeight }