From b29e2aa5c6d1dc7933e134be1d34d12f85c041af Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 13 Sep 2021 22:42:34 +0300 Subject: [PATCH] Return voice chat recording title setup --- .../Telegram-iOS/en.lproj/Localizable.strings | 3 + .../Sources/VoiceChatController.swift | 68 +++++++++++-------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index ab3732c834..63fa70f5c4 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -5837,8 +5837,11 @@ Sorry for the inconvenience."; "VoiceChat.StartRecordingText" = "Do you want to start recording this chat and save the result into an audio file?\n\nOther members will see that the chat is being recorded."; "LiveStream.StartRecordingText" = "Do you want to start recording this live stream and save the result into an audio file?\n\nOther members will see that the chat is being recorded."; "VoiceChat.StartRecordingStart" = "Start"; +"VoiceChat.StartRecordingTextVideo" = "Do you want to start recording this chat and save the result into a video file?\n\nOther members will see that the chat is being recorded."; +"LiveStream.StartRecordingTextVideo" = "Do you want to start recording this live stream and save the result into a video file?\n\nOther members will see that the chat is being recorded."; "VoiceChat.RecordingTitlePlaceholder" = "Audio Title (Optional)"; +"VoiceChat.RecordingTitlePlaceholderVideo" = "Video Title (Optional)"; "VoiceChat.RecordingStarted" = "Voice chat recording started"; "LiveStream.RecordingStarted" = "Live stream recording started"; "VoiceChat.RecordingInProgress" = "Voice chat is being recorded"; diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index be0cd594f8..63022e55da 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -2657,38 +2657,48 @@ public final class VoiceChatController: ViewController { let controller = VoiceChatRecordingSetupController(context: strongSelf.context, completion: { [weak self] videoOrientation in if let strongSelf = self { - strongSelf.call.setShouldBeRecording(true, title: "", videoOrientation: videoOrientation) + let title: String + let text: String + let placeholder: String + if let _ = videoOrientation { + placeholder = strongSelf.presentationData.strings.VoiceChat_RecordingTitlePlaceholderVideo + } else { + placeholder = strongSelf.presentationData.strings.VoiceChat_RecordingTitlePlaceholder + } + if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info { + title = strongSelf.presentationData.strings.LiveStream_StartRecordingTitle + if let _ = videoOrientation { + text = strongSelf.presentationData.strings.LiveStream_StartRecordingTextVideo + } else { + text = strongSelf.presentationData.strings.LiveStream_StartRecordingText + } + } else { + title = strongSelf.presentationData.strings.VoiceChat_StartRecordingTitle + if let _ = videoOrientation { + text = strongSelf.presentationData.strings.VoiceChat_StartRecordingTextVideo + } else { + text = strongSelf.presentationData.strings.VoiceChat_StartRecordingText + } + } - strongSelf.presentUndoOverlay(content: .voiceChatRecording(text: text), action: { _ in return false }) - strongSelf.call.playTone(.recordingStarted) + let controller = voiceChatTitleEditController(sharedContext: strongSelf.context.sharedContext, account: strongSelf.context.account, forceTheme: strongSelf.darkTheme, title: title, text: text, placeholder: placeholder, value: nil, maxLength: 40, apply: { title in + if let strongSelf = self, let title = title { + strongSelf.call.setShouldBeRecording(true, title: title, videoOrientation: videoOrientation) + + let text: String + if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info { + text = strongSelf.presentationData.strings.LiveStream_RecordingStarted + } else { + text = strongSelf.presentationData.strings.VoiceChat_RecordingStarted + } + + strongSelf.presentUndoOverlay(content: .voiceChatRecording(text: text), action: { _ in return false }) + strongSelf.call.playTone(.recordingStarted) + } + }) + strongSelf.controller?.present(controller, in: .window(.root)) } }) - -// let title: String -// let text: String -// if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info { -// title = strongSelf.presentationData.strings.LiveStream_StartRecordingTitle -// text = strongSelf.presentationData.strings.LiveStream_StartRecordingText -// } else { -// title = strongSelf.presentationData.strings.VoiceChat_StartRecordingTitle -// text = strongSelf.presentationData.strings.VoiceChat_StartRecordingText -// } -// -// let controller = voiceChatTitleEditController(sharedContext: strongSelf.context.sharedContext, account: strongSelf.context.account, forceTheme: strongSelf.darkTheme, title: title, text: text, placeholder: strongSelf.presentationData.strings.VoiceChat_RecordingTitlePlaceholder, value: nil, maxLength: 40, apply: { title in -// if let strongSelf = self, let title = title { -// strongSelf.call.setShouldBeRecording(true, title: title, videoOrientation: nil) -// -// let text: String -// if let channel = strongSelf.peer as? TelegramChannel, case .broadcast = channel.info { -// text = strongSelf.presentationData.strings.LiveStream_RecordingStarted -// } else { -// text = strongSelf.presentationData.strings.VoiceChat_RecordingStarted -// } -// -// strongSelf.presentUndoOverlay(content: .voiceChatRecording(text: text), action: { _ in return false }) -// strongSelf.call.playTone(.recordingStarted) -// } -// }) self?.controller?.present(controller, in: .window(.root)) }))) }