Keep screen on when recording voice message

pull/531/head
ryanzhao 3 years ago
parent e49431d2eb
commit 13b7b1edb6

@ -762,6 +762,8 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
requestMicrophonePermissionIfNeeded() { [weak self] in requestMicrophonePermissionIfNeeded() { [weak self] in
self?.cancelVoiceMessageRecording() self?.cancelVoiceMessageRecording()
} }
// Keep screen on
UIApplication.shared.isIdleTimerDisabled = false
guard AVAudioSession.sharedInstance().recordPermission == .granted else { return } guard AVAudioSession.sharedInstance().recordPermission == .granted else { return }
// Cancel any current audio playback // Cancel any current audio playback
audioPlayer?.stop() audioPlayer?.stop()
@ -810,6 +812,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
} }
func endVoiceMessageRecording() { func endVoiceMessageRecording() {
UIApplication.shared.isIdleTimerDisabled = true
// Hide the UI // Hide the UI
snInputView.hideVoiceMessageUI() snInputView.hideVoiceMessageUI()
// Cancel the timer // Cancel the timer

Loading…
Cancel
Save