mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Video message recording improvements
This commit is contained in:
@@ -689,6 +689,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
return false
|
||||
}
|
||||
|
||||
if strongSelf.presentRecordedVoiceMessageDiscardAlert(action: action, performAction: false) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -743,6 +747,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.openViewOnceMediaMessage(message)
|
||||
return false
|
||||
}
|
||||
} else if file.isVideo {
|
||||
if !displayVoiceMessageDiscardAlert() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if let invoice = media as? TelegramMediaInvoice, let extendedMedia = invoice.extendedMedia {
|
||||
@@ -17359,6 +17367,25 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
return false
|
||||
}
|
||||
|
||||
func presentRecordedVoiceMessageDiscardAlert(action: @escaping () -> Void = {}, alertAction: (() -> Void)? = nil, delay: Bool = false, performAction: Bool = true) -> Bool {
|
||||
if let _ = self.presentationInterfaceState.recordedMediaPreview {
|
||||
alertAction?()
|
||||
Queue.mainQueue().after(delay ? 0.2 : 0.0) {
|
||||
self.present(textAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, title: nil, text: self.presentationData.strings.Conversation_DiscardRecordedVoiceMessageDescription, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_Cancel, action: {}), TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Conversation_DiscardRecordedVoiceMessageAction, action: { [weak self] in
|
||||
self?.stopMediaRecorder()
|
||||
Queue.mainQueue().after(0.1) {
|
||||
action()
|
||||
}
|
||||
})]), in: .window(.root))
|
||||
}
|
||||
|
||||
return true
|
||||
} else if performAction {
|
||||
action()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func presentAutoremoveSetup() {
|
||||
guard let peer = self.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user