File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
packages/react-native-sdk/ios Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,11 @@ class StreamInCallManager: RCTEventEmitter {
7979 options: session. categoryOptions
8080 )
8181 configureAudioSession ( )
82- // Enable wake lock to prevent the screen from dimming/locking during a call
82+
8383 DispatchQueue . main. async {
84+ // Enable wake lock to prevent the screen from dimming/locking during a call
8485 UIApplication . shared. isIdleTimerDisabled = true
86+ // Register for audio route changes to turn off screen when earpiece is connected
8587 self . registerAudioRouteObserver ( )
8688 self . updateProximityMonitoring ( )
8789 self . log ( " Wake lock enabled (idle timer disabled) " )
@@ -120,8 +122,10 @@ class StreamInCallManager: RCTEventEmitter {
120122 }
121123 // Disable wake lock and proximity when call manager stops so the device can sleep again
122124 DispatchQueue . main. async {
125+ // Disable proximity monitoring to disable earpiece detection
123126 self . setProximityMonitoringEnabled ( false )
124127 self . unregisterAudioRouteObserver ( )
128+ // Disable wake lock to allow the screen to dim/lock again
125129 UIApplication . shared. isIdleTimerDisabled = false
126130 self . log ( " Wake lock disabled (idle timer enabled) " )
127131 }
You can’t perform that action at this time.
0 commit comments