diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index ceacdfe9dc..a1025aa0f5 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -746,7 +746,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } }, sendCurrentMessage: { [weak self] silentPosting in if let strongSelf = self { - strongSelf.chatDisplayNode.sendCurrentMessage(silentPosting: silentPosting) + if let _ = strongSelf.presentationInterfaceState.recordedMediaPreview { + strongSelf.sendMediaRecording(silently: silentPosting) + } else { + strongSelf.chatDisplayNode.sendCurrentMessage(silentPosting: silentPosting) + } } }, sendMessage: { [weak self] text in guard let strongSelf = self, canSendMessagesToChat(strongSelf.presentationInterfaceState) else { @@ -4646,8 +4650,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G strongSelf.lockMediaRecorder() }, deleteRecordedMedia: { [weak self] in self?.deleteMediaRecording() - }, sendRecordedMedia: { [weak self] in - self?.sendMediaRecording() + }, sendRecordedMedia: { [weak self] silently in + self?.sendMediaRecording(silently: silently) }, displayRestrictedInfo: { [weak self] subject, displayType in guard let strongSelf = self else { return @@ -8278,7 +8282,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G }) } - private func sendMediaRecording() { + private func sendMediaRecording(silently: Bool) { self.chatDisplayNode.updateRecordedMediaDeleted(false) if let recordedMediaPreview = self.presentationInterfaceState.recordedMediaPreview { if let _ = self.presentationInterfaceState.slowmodeState, !self.presentationInterfaceState.isScheduledMessages { @@ -8298,7 +8302,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } }) - self.sendMessages([.message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: arc4random64()), partialReference: nil, resource: recordedMediaPreview.resource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "audio/ogg", size: Int(recordedMediaPreview.fileSize), attributes: [.Audio(isVoice: true, duration: Int(recordedMediaPreview.duration), title: nil, performer: nil, waveform: waveformBuffer)])), replyToMessageId: self.presentationInterfaceState.interfaceState.replyMessageId, localGroupingKey: nil)]) + var attributes: [MessageAttribute] = [] + if silently { + attributes.append(NotificationInfoMessageAttribute(flags: .muted)) + } + + self.sendMessages([.message(text: "", attributes: attributes, mediaReference: .standalone(media: TelegramMediaFile(fileId: MediaId(namespace: Namespaces.Media.LocalFile, id: arc4random64()), partialReference: nil, resource: recordedMediaPreview.resource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: "audio/ogg", size: Int(recordedMediaPreview.fileSize), attributes: [.Audio(isVoice: true, duration: Int(recordedMediaPreview.duration), title: nil, performer: nil, waveform: waveformBuffer)])), replyToMessageId: self.presentationInterfaceState.interfaceState.replyMessageId, localGroupingKey: nil)]) } } diff --git a/submodules/TelegramUI/Sources/ChatPanelInterfaceInteraction.swift b/submodules/TelegramUI/Sources/ChatPanelInterfaceInteraction.swift index 5e9a6ef85c..ebd3ed3e57 100644 --- a/submodules/TelegramUI/Sources/ChatPanelInterfaceInteraction.swift +++ b/submodules/TelegramUI/Sources/ChatPanelInterfaceInteraction.swift @@ -87,7 +87,7 @@ final class ChatPanelInterfaceInteraction { let stopMediaRecording: () -> Void let lockMediaRecording: () -> Void let deleteRecordedMedia: () -> Void - let sendRecordedMedia: () -> Void + let sendRecordedMedia: (Bool) -> Void let displayRestrictedInfo: (ChatPanelRestrictionInfoSubject, ChatPanelRestrictionInfoDisplayType) -> Void let displayVideoUnmuteTip: (CGPoint?) -> Void let switchMediaRecordingMode: () -> Void @@ -163,7 +163,7 @@ final class ChatPanelInterfaceInteraction { stopMediaRecording: @escaping () -> Void, lockMediaRecording: @escaping () -> Void, deleteRecordedMedia: @escaping () -> Void, - sendRecordedMedia: @escaping () -> Void, + sendRecordedMedia: @escaping (Bool) -> Void, displayRestrictedInfo: @escaping (ChatPanelRestrictionInfoSubject, ChatPanelRestrictionInfoDisplayType) -> Void, displayVideoUnmuteTip: @escaping (CGPoint?) -> Void, switchMediaRecordingMode: @escaping () -> Void, diff --git a/submodules/TelegramUI/Sources/ChatRecentActionsController.swift b/submodules/TelegramUI/Sources/ChatRecentActionsController.swift index 7a35c46b71..f6c30c969e 100644 --- a/submodules/TelegramUI/Sources/ChatRecentActionsController.swift +++ b/submodules/TelegramUI/Sources/ChatRecentActionsController.swift @@ -91,7 +91,7 @@ final class ChatRecentActionsController: TelegramBaseController { }, stopMediaRecording: { }, lockMediaRecording: { }, deleteRecordedMedia: { - }, sendRecordedMedia: { + }, sendRecordedMedia: { _ in }, displayRestrictedInfo: { _, _ in }, displayVideoUnmuteTip: { _ in }, switchMediaRecordingMode: { diff --git a/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift index c5f753bf36..157bbab950 100644 --- a/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift @@ -291,7 +291,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode { } @objc func sendPressed() { - self.interfaceInteraction?.sendRecordedMedia() + self.interfaceInteraction?.sendRecordedMedia(false) } @objc func waveformPressed() { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index a0c7e1c066..7ef66e7c6e 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -397,7 +397,7 @@ final class PeerInfoSelectionPanelNode: ASDisplayNode { }, stopMediaRecording: { }, lockMediaRecording: { }, deleteRecordedMedia: { - }, sendRecordedMedia: { + }, sendRecordedMedia: { _ in }, displayRestrictedInfo: { _, _ in }, displayVideoUnmuteTip: { _ in }, switchMediaRecordingMode: {