From a84760b27115bb7ddcdd8b637d1518e647e8a7e5 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Mon, 7 Mar 2022 16:04:47 +0100 Subject: [PATCH] Prevent screen from turning off while recording a voice message --- Classes/ChatConversationView.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 25fc1fb29..896981e63 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -304,6 +304,7 @@ static UICompositeViewDescription *compositeDescription = nil; [NSNotificationCenter.defaultCenter removeObserver:self]; PhoneMainView.instance.currentRoom = NULL; + [[UIApplication sharedApplication] setIdleTimerDisabled:false]; } - (void)removeCallBacks { @@ -1758,6 +1759,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog } -(void) cancelVoiceRecording { + [[UIApplication sharedApplication] setIdleTimerDisabled:false]; _showVoiceRecorderView = false; _toggleRecord.selected = false; [self updateFramesInclRecordingAndReplyView]; @@ -1774,6 +1776,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog } -(void) stopVoiceRecording { + [[UIApplication sharedApplication] setIdleTimerDisabled:false]; if (_voiceRecorder && linphone_recorder_get_state(_voiceRecorder) == LinphoneRecorderRunning) { LOGI(@"[Chat Message Sending] Pausing / closing voice recorder"); linphone_recorder_pause(_voiceRecorder); @@ -1794,6 +1797,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog } -(void) startVoiceRecording { + [[UIApplication sharedApplication] setIdleTimerDisabled:true]; if (!_voiceRecorder) [self createVoiceRecorder];