mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 15:38:28 +02:00
Disable proximity sensor and enable sleep after call ended
This commit is contained in:
@@ -1422,29 +1422,26 @@ static const CGFloat kLocalPreviewMargin = 20;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateProximityAndSleep
|
||||
{
|
||||
BOOL inCall = (mxCall.state == MXCallStateConnected || mxCall.state == MXCallStateRinging || mxCall.state == MXCallStateInviteSent || mxCall.state == MXCallStateConnecting || mxCall.state == MXCallStateCreateOffer || mxCall.state == MXCallStateCreateAnswer);
|
||||
|
||||
if (inCall)
|
||||
{
|
||||
BOOL isBuiltInReceiverUsed = self.isBuiltInReceiverAudioOuput;
|
||||
|
||||
// Enable the proximity monitoring when the built in receiver is used as the audio output.
|
||||
BOOL enableProxMonitoring = isBuiltInReceiverUsed;
|
||||
[[UIDevice currentDevice] setProximityMonitoringEnabled:enableProxMonitoring];
|
||||
|
||||
// Disable the idle timer during a video call, or during a voice call which is performed with the built-in receiver.
|
||||
// Note: if the device is locked, VoIP calling get dropped if an incoming GSM call is received.
|
||||
BOOL disableIdleTimer = mxCall.isVideoCall || isBuiltInReceiverUsed;
|
||||
|
||||
UIApplication *sharedApplication = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
if (sharedApplication)
|
||||
{
|
||||
sharedApplication.idleTimerDisabled = disableIdleTimer;
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)updateProximityAndSleep
|
||||
{
|
||||
BOOL inCall = (mxCall.state == MXCallStateConnected || mxCall.state == MXCallStateRinging || mxCall.state == MXCallStateInviteSent || mxCall.state == MXCallStateConnecting || mxCall.state == MXCallStateCreateOffer || mxCall.state == MXCallStateCreateAnswer);
|
||||
|
||||
BOOL isBuiltInReceiverUsed = self.isBuiltInReceiverAudioOuput;
|
||||
|
||||
// Enable the proximity monitoring when the built in receiver is used as the audio output.
|
||||
BOOL enableProxMonitoring = inCall && isBuiltInReceiverUsed;
|
||||
[[UIDevice currentDevice] setProximityMonitoringEnabled:enableProxMonitoring];
|
||||
|
||||
// Disable the idle timer during a video call, or during a voice call which is performed with the built-in receiver.
|
||||
// Note: if the device is locked, VoIP calling get dropped if an incoming GSM call is received.
|
||||
BOOL disableIdleTimer = inCall && (mxCall.isVideoCall || isBuiltInReceiverUsed);
|
||||
|
||||
UIApplication *sharedApplication = [UIApplication performSelector:@selector(sharedApplication)];
|
||||
if (sharedApplication)
|
||||
{
|
||||
sharedApplication.idleTimerDisabled = disableIdleTimer;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)createIncomingCallView
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user