From 80329e8ffee978de00e486fcd808c9ff7cf419b3 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Tue, 19 Sep 2017 14:14:17 -0500 Subject: [PATCH] [RN] CONFERENCE_FAILED error message in redux In order to support XMPP authentication, we'll need the message accompanying the error and carried by lib-jitsi-meet's CONFERENCE_FAILED in the redux store. We already carry the message in the redux action and we've got the error in the redux store. --- .../base/connection/actions.native.js | 7 +++--- react/features/base/connection/reducer.js | 22 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/react/features/base/connection/actions.native.js b/react/features/base/connection/actions.native.js index 08374831d..0a60a8257 100644 --- a/react/features/base/connection/actions.native.js +++ b/react/features/base/connection/actions.native.js @@ -76,13 +76,14 @@ export function connect() { * Rejects external promise when connection fails. * * @param {JitsiConnectionErrors} err - Connection error. + * @param {string} msg - Error message supplied by lib-jitsi-meet. * @returns {void} * @private */ - function _onConnectionFailed(err) { + function _onConnectionFailed(err, msg) { unsubscribe(); - console.error('CONNECTION FAILED:', err); - dispatch(connectionFailed(connection, err)); + console.error('CONNECTION FAILED:', err, msg); + dispatch(connectionFailed(connection, err, msg)); } /** diff --git a/react/features/base/connection/reducer.js b/react/features/base/connection/reducer.js index 035e383fd..a2f50d6ed 100644 --- a/react/features/base/connection/reducer.js +++ b/react/features/base/connection/reducer.js @@ -1,6 +1,6 @@ /* @flow */ -import { assign, ReducerRegistry, set } from '../redux'; +import { assign, ReducerRegistry } from '../redux'; import { parseURIString } from '../util'; import { @@ -75,7 +75,9 @@ function _connectionEstablished( { connection }: { connection: Object }) { return assign(state, { connecting: undefined, - connection + connection, + error: undefined, + errorMessage: undefined }); } @@ -91,14 +93,20 @@ function _connectionEstablished( */ function _connectionFailed( state: Object, - { connection }: { connection: Object }) { + { connection, error, message }: { + connection: Object, + error: string, + message: ?string + }) { if (state.connection && state.connection !== connection) { return state; } return assign(state, { connecting: undefined, - connection: undefined + connection: undefined, + error, + errorMessage: message }); } @@ -115,7 +123,11 @@ function _connectionFailed( function _connectionWillConnect( state: Object, { connection }: { connection: Object }) { - return set(state, 'connecting', connection); + return assign(state, { + connecting: connection, + error: undefined, + errorMessage: undefined + }); } /**