[RN] Fix redux state cleanup

The preceding commit "fix(auth.native): trigger conference left on
cancel" did not correctly clean the redux state up on CONFERENCE_LEFT.
This commit is contained in:
Lyubo Marinov 2017-10-24 13:58:08 -05:00
parent dedd10c62a
commit 499ee7985b
2 changed files with 21 additions and 13 deletions

View File

@ -84,11 +84,16 @@ export function cancelLogin() {
export function cancelWaitForOwner() {
return (dispatch: Dispatch<*>, getState: Function) => {
dispatch(stopWaitForOwner());
// XXX The error associated with CONFERENCE_FAILED was marked as
// recoverable by the feature room-lock and, consequently,
// recoverable-aware features such as mobile's external-api did not
// deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since the
// app/user is going to nativate to WelcomePage, the SDK
// clients/consumers need an event.
const { authRequired } = getState()['features/base/conference'];
if (authRequired) {
dispatch(conferenceLeft(authRequired));
}
authRequired && dispatch(conferenceLeft(authRequired));
dispatch(appNavigate(undefined));
};

View File

@ -183,31 +183,34 @@ function _conferenceJoined(state, { conference }) {
* reduction of the specified action.
*/
function _conferenceLeft(state, { conference }) {
let output = state;
let nextState = state;
if (state.authRequired === conference) {
output = set(output, 'authRequired', undefined);
nextState = set(nextState, 'authRequired', undefined);
}
if (state.conference === conference) {
output = assign(output, {
nextState = assign(nextState, {
conference: undefined,
joining: undefined,
leaving: undefined
leaving: undefined,
// XXX Clear/unset locked & password here for a conference which has
// been LOCKED_LOCALLY.
locked: undefined,
password: undefined
});
}
if (state.passwordRequired === conference) {
// Note that in case the conference was joined those fields have been
// cleared already, so this step needs to be done only if the room
// unlock operation has been canceled and that's why it's not done in
// the 'state.conference' condition above.
output = assign(output, {
nextState = assign(nextState, {
// XXX Clear/unset locked & password here for a conference which has
// been LOCKED_REMOTELY.
locked: undefined,
password: undefined,
passwordRequired: undefined
});
}
return output;
return nextState;
}
/**