Browse Source

fix(auth.native): trigger conference left on cancel

Triggering the 'conference left' action when the wait for owner dialog
is dismissed will let the Call Kit implementation end the call, after
a recoverable conference failed event was emitted.

Also fixes conference state reduction when 'conference left' is emitted
by room lock or auth features where the conference has not been joined
yet.
j8
paweldomas 8 years ago
parent
commit
dedd10c62a
2 changed files with 31 additions and 13 deletions
  1. 8
    2
      react/features/authentication/actions.js
  2. 23
    11
      react/features/base/conference/reducer.js

+ 8
- 2
react/features/authentication/actions.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { appNavigate } from '../app';
3
 import { appNavigate } from '../app';
4
-import { checkIfCanJoin } from '../base/conference';
4
+import { checkIfCanJoin, conferenceLeft } from '../base/conference';
5
 import { openDialog } from '../base/dialog';
5
 import { openDialog } from '../base/dialog';
6
 
6
 
7
 import {
7
 import {
82
  * @returns {Function}
82
  * @returns {Function}
83
  */
83
  */
84
 export function cancelWaitForOwner() {
84
 export function cancelWaitForOwner() {
85
-    return (dispatch: Dispatch<*>) => {
85
+    return (dispatch: Dispatch<*>, getState: Function) => {
86
         dispatch(stopWaitForOwner());
86
         dispatch(stopWaitForOwner());
87
+        const { authRequired } = getState()['features/base/conference'];
88
+
89
+        if (authRequired) {
90
+            dispatch(conferenceLeft(authRequired));
91
+        }
92
+
87
         dispatch(appNavigate(undefined));
93
         dispatch(appNavigate(undefined));
88
     };
94
     };
89
 }
95
 }

+ 23
- 11
react/features/base/conference/reducer.js View File

183
  * reduction of the specified action.
183
  * reduction of the specified action.
184
  */
184
  */
185
 function _conferenceLeft(state, { conference }) {
185
 function _conferenceLeft(state, { conference }) {
186
-    if (state.conference !== conference) {
187
-        return state;
186
+    let output = state;
187
+
188
+    if (state.authRequired === conference) {
189
+        output = set(output, 'authRequired', undefined);
190
+    }
191
+    if (state.conference === conference) {
192
+        output = assign(output, {
193
+            conference: undefined,
194
+            joining: undefined,
195
+            leaving: undefined
196
+        });
197
+    }
198
+    if (state.passwordRequired === conference) {
199
+        // Note that in case the conference was joined those fields have been
200
+        // cleared already, so this step needs to be done only if the room
201
+        // unlock operation has been canceled and that's why it's not done in
202
+        // the 'state.conference' condition above.
203
+        output = assign(output, {
204
+            locked: undefined,
205
+            password: undefined,
206
+            passwordRequired: undefined
207
+        });
188
     }
208
     }
189
 
209
 
190
-    return assign(state, {
191
-        authRequired: undefined,
192
-        conference: undefined,
193
-        joining: undefined,
194
-        leaving: undefined,
195
-        locked: undefined,
196
-        password: undefined,
197
-        passwordRequired: undefined
198
-    });
210
+    return output;
199
 }
211
 }
200
 
212
 
201
 /**
213
 /**

Loading…
Cancel
Save