From 7ad0639f7ab62abbf4373ebb76c4308855563ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 1 Aug 2018 14:31:18 +0200 Subject: [PATCH] [RN] Fix setting audio mode for audio-only calls When a call is tarted in audio only mode due to the switch on the welcome page, the wrong audio mode was chosen. --- .../features/mobile/audio-mode/middleware.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/react/features/mobile/audio-mode/middleware.js b/react/features/mobile/audio-mode/middleware.js index dc7c70ec9..daa303508 100644 --- a/react/features/mobile/audio-mode/middleware.js +++ b/react/features/mobile/audio-mode/middleware.js @@ -11,6 +11,8 @@ import { } from '../../base/conference'; import { MiddlewareRegistry } from '../../base/redux'; +const AudioMode = NativeModules.AudioMode; + /** * Middleware that captures conference actions and sets the correct audio mode * based on the type of conference. Audio-only conferences don't use the speaker @@ -20,7 +22,7 @@ import { MiddlewareRegistry } from '../../base/redux'; * @returns {Function} */ MiddlewareRegistry.register(({ getState }) => next => action => { - const AudioMode = NativeModules.AudioMode; + const result = next(action); if (AudioMode) { let mode; @@ -43,13 +45,13 @@ MiddlewareRegistry.register(({ getState }) => next => action => { */ case CONFERENCE_JOINED: case SET_AUDIO_ONLY: { - if (getState()['features/base/conference'].conference - || action.conference) { - mode - = action.audioOnly - ? AudioMode.AUDIO_CALL - : AudioMode.VIDEO_CALL; - } + const { audioOnly, conference } + = getState()['features/base/conference']; + + conference + && (mode = audioOnly + ? AudioMode.AUDIO_CALL + : AudioMode.VIDEO_CALL); break; } } @@ -62,5 +64,5 @@ MiddlewareRegistry.register(({ getState }) => next => action => { } } - return next(action); + return result; });