浏览代码

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 年前
父节点
当前提交
dedd10c62a
共有 2 个文件被更改,包括 31 次插入13 次删除
  1. 8
    2
      react/features/authentication/actions.js
  2. 23
    11
      react/features/base/conference/reducer.js

+ 8
- 2
react/features/authentication/actions.js 查看文件

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

+ 23
- 11
react/features/base/conference/reducer.js 查看文件

@@ -183,19 +183,31 @@ function _conferenceJoined(state, { conference }) {
183 183
  * reduction of the specified action.
184 184
  */
185 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
 /**

正在加载...
取消
保存