From 6616f728f6cb6e55a353729c908e2b66558935af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 14 Aug 2019 13:02:19 +0200 Subject: [PATCH] proximity: enable the proximity sensor when the device is set to earpiece --- react/features/mobile/proximity/middleware.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/react/features/mobile/proximity/middleware.js b/react/features/mobile/proximity/middleware.js index f4549da0b..28dbd642a 100644 --- a/react/features/mobile/proximity/middleware.js +++ b/react/features/mobile/proximity/middleware.js @@ -7,14 +7,15 @@ import { StateListenerRegistry } from '../../base/redux'; * State listener which enables / disables the proximity sensor based on the * current conference state. If the proximity sensor is enabled, it will dim * the screen and disable touch controls when an object is nearby. The - * functionality is enabled when a conference is in audio-only mode. + * functionality is enabled when the current audio device is the earpiece. */ StateListenerRegistry.register( /* selector */ state => { - const { enabled: audioOnly } = state['features/base/audio-only']; + const { devices } = state['features/mobile/audio-mode']; + const selectedDevice = devices.filter(d => d.selected)[0]; const conference = getCurrentConference(state); - return Boolean(conference && audioOnly); + return Boolean(conference && selectedDevice?.type === 'EARPIECE'); }, /* listener */ proximityEnabled => _setProximityEnabled(proximityEnabled) );