[RN] Fix disconnecting before the connection was established

Keep track of the connection and conference objects so we can leave and / or
disconnect early, before the connection is established or the conference joined.
This commit is contained in:
Saúl Ibarra Corretgé
2017-07-06 13:51:35 +02:00
committed by Lyubo Marinov
parent 99b856233d
commit c4232b34ae
6 changed files with 121 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ import {
CONFERENCE_FAILED,
CONFERENCE_JOINED,
CONFERENCE_LEFT,
CONFERENCE_WILL_JOIN,
CONFERENCE_WILL_LEAVE,
LOCK_STATE_CHANGED,
SET_AUDIO_ONLY,
@@ -32,6 +33,9 @@ ReducerRegistry.register('features/base/conference', (state = {}, action) => {
case CONFERENCE_LEFT:
return _conferenceLeft(state, action);
case CONFERENCE_WILL_JOIN:
return _conferenceWillJoin(state, action);
case CONFERENCE_WILL_LEAVE:
return _conferenceWillLeave(state, action);
@@ -84,6 +88,7 @@ function _conferenceFailed(state, action) {
audioOnly: undefined,
audioOnlyVideoMuted: undefined,
conference: undefined,
joining: undefined,
leaving: undefined,
/**
@@ -133,6 +138,7 @@ function _conferenceJoined(state, action) {
* @type {JitsiConference}
*/
conference,
joining: undefined,
leaving: undefined,
/**
@@ -167,6 +173,7 @@ function _conferenceLeft(state, action) {
audioOnly: undefined,
audioOnlyVideoMuted: undefined,
conference: undefined,
joining: undefined,
leaving: undefined,
locked: undefined,
password: undefined,
@@ -174,6 +181,20 @@ function _conferenceLeft(state, action) {
}));
}
/**
* Reduces a specific Redux action CONFERENCE_WILL_JOIN of the feature
* base/conference.
*
* @param {Object} state - The Redux state of the feature base/conference.
* @param {Action} action - The Redux action CONFERENCE_WILL_JOIN to reduce.
* @private
* @returns {Object} The new state of the feature base/conference after the
* reduction of the specified action.
*/
function _conferenceWillJoin(state, action) {
return set(state, 'joining', action.conference);
}
/**
* Reduces a specific Redux action CONFERENCE_WILL_LEAVE of the feature
* base/conference.