Sfoglia il codice sorgente

[RN] CONFERENCE_LEFT upon canceling PasswordRequiredPrompt

j8
Lyubo Marinov 8 anni fa
parent
commit
a561d4f302

+ 41
- 4
react/features/room-lock/actions.js Vedi File

@@ -1,6 +1,11 @@
1 1
 // @flow
2 2
 
3
-import { setPassword } from '../base/conference';
3
+import { appNavigate } from '../app';
4
+import {
5
+    conferenceLeft,
6
+    JITSI_CONFERENCE_URL_KEY,
7
+    setPassword
8
+} from '../base/conference';
4 9
 import { hideDialog, openDialog } from '../base/dialog';
5 10
 import { PasswordRequiredPrompt, RoomLockPrompt } from './components';
6 11
 
@@ -23,6 +28,38 @@ export function beginRoomLockRequest(conference: ?Object) {
23 28
     };
24 29
 }
25 30
 
31
+/**
32
+ * Cancels a prompt for a password to join a specific conference/room.
33
+ *
34
+ * @param {JitsiConference} conference - The {@code JitsiConference} requesting
35
+ * the password to join.
36
+ * @protected
37
+ * @returns {Function}
38
+ */
39
+export function _cancelPasswordRequiredPrompt(conference: Object) {
40
+    return (dispatch: Dispatch<*>, getState: Function) => {
41
+        // Canceling PasswordRequiredPrompt is to navigate the app/user to
42
+        // WelcomePage. In other words, the canceling invalidates the
43
+        // locationURL. Make sure that the canceling indeed has the intent to
44
+        // invalidate the locationURL.
45
+        const state = getState();
46
+
47
+        if (conference === state['features/base/conference'].passwordRequired
48
+                && conference[JITSI_CONFERENCE_URL_KEY]
49
+                    === state['features/base/connection'].locationURL) {
50
+            // XXX The error associated with CONFERENCE_FAILED was marked as
51
+            // recoverable by the feature room-lock and, consequently,
52
+            // recoverable-aware features such as mobile's external-api did not
53
+            // deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since
54
+            // the app/user is going to nativate to WelcomePage, the SDK
55
+            // clients/consumers need an event.
56
+            dispatch(conferenceLeft(conference));
57
+
58
+            dispatch(appNavigate(undefined));
59
+        }
60
+    };
61
+}
62
+
26 63
 /**
27 64
  * Ends a (user) request to lock a specific conference/room.
28 65
  *
@@ -47,10 +84,10 @@ export function endRoomLockRequest(
47 84
 }
48 85
 
49 86
 /**
50
- * Begins a request to enter password for a specific conference/room.
87
+ * Begins a prompt for a password to join a specific conference/room.
51 88
  *
52
- * @param {JitsiConference} conference - The JitsiConference
53
- * requesting password.
89
+ * @param {JitsiConference} conference - The {@code JitsiConference}
90
+ * requesting the password to join.
54 91
  * @protected
55 92
  * @returns {{
56 93
  *     type: OPEN_DIALOG,

+ 4
- 2
react/features/room-lock/components/PasswordRequiredPrompt.native.js Vedi File

@@ -4,10 +4,11 @@ import PropTypes from 'prop-types';
4 4
 import React, { Component } from 'react';
5 5
 import { connect } from 'react-redux';
6 6
 
7
-import { appNavigate } from '../../app';
8 7
 import { setPassword } from '../../base/conference';
9 8
 import { Dialog } from '../../base/dialog';
10 9
 
10
+import { _cancelPasswordRequiredPrompt } from '../actions';
11
+
11 12
 /**
12 13
  * {@code PasswordRequiredPrompt}'s React {@code Component} prop types.
13 14
  */
@@ -87,7 +88,8 @@ class PasswordRequiredPrompt extends Component {
87 88
      * otherwise, {@code false}.
88 89
      */
89 90
     _onCancel() {
90
-        this.props.dispatch(appNavigate(undefined));
91
+        this.props.dispatch(
92
+            _cancelPasswordRequiredPrompt(this.props.conference));
91 93
 
92 94
         return true;
93 95
     }

Loading…
Annulla
Salva