ソースを参照

fix(rn,dialogs,auth) fix not showing authentication dialogs

1) Fix not being able to show multiple dialogs at once in iOS
2) Fix cancelling the login dialog when XMPP auth is enabled without
   guest support
master
Saúl Ibarra Corretgé 3年前
コミット
fca9a249dc

+ 22
- 4
react/features/authentication/components/native/LoginDialog.js ファイルの表示

@@ -44,6 +44,11 @@ type Props = {
44 44
      */
45 45
     _error: Object,
46 46
 
47
+    /**
48
+     * Extra handler for cancel functionality.
49
+     */
50
+    _onCancel: Function,
51
+
47 52
     /**
48 53
      * The progress in the floating range between 0 and 1 of the authenticating
49 54
      * and upgrading the role of the local participant/user.
@@ -63,7 +68,12 @@ type Props = {
63 68
     /**
64 69
      * Invoked to obtain translated strings.
65 70
      */
66
-    t: Function
71
+    t: Function,
72
+
73
+    /**
74
+     * Override the default visibility.
75
+     */
76
+    visible: boolean
67 77
 };
68 78
 
69 79
 /**
@@ -110,6 +120,10 @@ type State = {
110 120
  * of the configuration parameters.
111 121
  */
112 122
 class LoginDialog extends Component<Props, State> {
123
+    static defaultProps = {
124
+        visible: true
125
+    };
126
+
113 127
     /**
114 128
      * Initializes a new LoginDialog instance.
115 129
      *
@@ -140,13 +154,14 @@ class LoginDialog extends Component<Props, State> {
140 154
     render() {
141 155
         const {
142 156
             _connecting: connecting,
143
-            t
157
+            t,
158
+            visible
144 159
         } = this.props;
145 160
 
146 161
         return (
147 162
             <View>
148 163
                 <Dialog.Container
149
-                    visible = { true }>
164
+                    visible = { visible }>
150 165
                     <Dialog.Title>
151 166
                         { t('dialog.login') }
152 167
                     </Dialog.Title>
@@ -280,7 +295,10 @@ class LoginDialog extends Component<Props, State> {
280 295
      * @returns {void}
281 296
      */
282 297
     _onCancel() {
283
-        this.props.dispatch(cancelLogin());
298
+        const { _onCancel, dispatch } = this.props;
299
+
300
+        _onCancel && _onCancel();
301
+        dispatch(cancelLogin());
284 302
     }
285 303
 
286 304
     _onLogin: () => void;

+ 25
- 3
react/features/authentication/components/native/WaitForOwnerDialog.js ファイルの表示

@@ -6,7 +6,9 @@ import type { Dispatch } from 'redux';
6 6
 import { ConfirmDialog } from '../../../base/dialog';
7 7
 import { translate } from '../../../base/i18n';
8 8
 import { connect } from '../../../base/redux';
9
-import { openLoginDialog, cancelWaitForOwner } from '../../actions.native';
9
+import { cancelWaitForOwner } from '../../actions.native';
10
+
11
+import LoginDialog from './LoginDialog';
10 12
 
11 13
 /**
12 14
  * The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
@@ -40,9 +42,14 @@ class WaitForOwnerDialog extends Component<Props> {
40 42
     constructor(props) {
41 43
         super(props);
42 44
 
45
+        this.state = {
46
+            showLoginDialog: false
47
+        };
48
+
43 49
         // Bind event handlers so they are only bound once per instance.
44 50
         this._onCancel = this._onCancel.bind(this);
45 51
         this._onLogin = this._onLogin.bind(this);
52
+        this._onLoginDialogCancel = this._onLoginDialogCancel.bind(this);
46 53
     }
47 54
 
48 55
     /**
@@ -58,7 +65,12 @@ class WaitForOwnerDialog extends Component<Props> {
58 65
                 confirmLabel = 'dialog.IamHost'
59 66
                 descriptionKey = 'dialog.WaitForHostMsg'
60 67
                 onCancel = { this._onCancel }
61
-                onSubmit = { this._onLogin } />
68
+                onSubmit = { this._onLogin }>
69
+                <LoginDialog
70
+                    // eslint-disable-next-line react/jsx-handler-names
71
+                    _onCancel = { this._onLoginDialogCancel }
72
+                    visible = { this.state.showLoginDialog } />
73
+            </ConfirmDialog>
62 74
         );
63 75
     }
64 76
 
@@ -83,7 +95,17 @@ class WaitForOwnerDialog extends Component<Props> {
83 95
      * @returns {void}
84 96
      */
85 97
     _onLogin() {
86
-        this.props.dispatch(openLoginDialog());
98
+        this.setState({ showLoginDialog: true });
99
+    }
100
+
101
+    /**
102
+     * Called when the nested login dialog is cancelled.
103
+     *
104
+     * @private
105
+     * @returns {void}
106
+     */
107
+    _onLoginDialogCancel() {
108
+        this.setState({ showLoginDialog: false });
87 109
     }
88 110
 }
89 111
 

+ 6
- 5
react/features/authentication/middleware.native.js ファイルの表示

@@ -62,13 +62,14 @@ MiddlewareRegistry.register(store => next => action => {
62 62
             // Go back to the app's entry point.
63 63
             _hideLoginDialog(store);
64 64
 
65
-            const { authRequired, conference } = getState()['features/base/conference'];
65
+            const state = getState();
66
+            const { authRequired, conference } = state['features/base/conference'];
67
+            const { passwordRequired } = state['features/base/connection'];
66 68
 
67 69
             // Only end the meeting if we are not already inside and trying to upgrade.
68
-            if (authRequired && !conference) {
69
-                // FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify
70
-                // the external-api.
71
-
70
+            // NOTE: Despite it's confusing name, `passwordRequired` implies an XMPP
71
+            // connection auth error.
72
+            if ((passwordRequired || authRequired) && !conference) {
72 73
                 dispatch(appNavigate(undefined));
73 74
             }
74 75
         }

読み込み中…
キャンセル
保存