[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.
This commit is contained in:
paweldomas 2017-09-19 14:14:17 -05:00 committed by Lyubo Marinov
parent 9621ba03f3
commit 80329e8ffe
2 changed files with 21 additions and 8 deletions

View File

@ -76,13 +76,14 @@ export function connect() {
* Rejects external promise when connection fails. * Rejects external promise when connection fails.
* *
* @param {JitsiConnectionErrors} err - Connection error. * @param {JitsiConnectionErrors} err - Connection error.
* @param {string} msg - Error message supplied by lib-jitsi-meet.
* @returns {void} * @returns {void}
* @private * @private
*/ */
function _onConnectionFailed(err) { function _onConnectionFailed(err, msg) {
unsubscribe(); unsubscribe();
console.error('CONNECTION FAILED:', err); console.error('CONNECTION FAILED:', err, msg);
dispatch(connectionFailed(connection, err)); dispatch(connectionFailed(connection, err, msg));
} }
/** /**

View File

@ -1,6 +1,6 @@
/* @flow */ /* @flow */
import { assign, ReducerRegistry, set } from '../redux'; import { assign, ReducerRegistry } from '../redux';
import { parseURIString } from '../util'; import { parseURIString } from '../util';
import { import {
@ -75,7 +75,9 @@ function _connectionEstablished(
{ connection }: { connection: Object }) { { connection }: { connection: Object }) {
return assign(state, { return assign(state, {
connecting: undefined, connecting: undefined,
connection connection,
error: undefined,
errorMessage: undefined
}); });
} }
@ -91,14 +93,20 @@ function _connectionEstablished(
*/ */
function _connectionFailed( function _connectionFailed(
state: Object, state: Object,
{ connection }: { connection: Object }) { { connection, error, message }: {
connection: Object,
error: string,
message: ?string
}) {
if (state.connection && state.connection !== connection) { if (state.connection && state.connection !== connection) {
return state; return state;
} }
return assign(state, { return assign(state, {
connecting: undefined, connecting: undefined,
connection: undefined connection: undefined,
error,
errorMessage: message
}); });
} }
@ -115,7 +123,11 @@ function _connectionFailed(
function _connectionWillConnect( function _connectionWillConnect(
state: Object, state: Object,
{ connection }: { connection: Object }) { { connection }: { connection: Object }) {
return set(state, 'connecting', connection); return assign(state, {
connecting: connection,
error: undefined,
errorMessage: undefined
});
} }
/** /**