Parcourir la source

[RN] CONFERENCE_FAILED error message in redux

In order to support XMPP authentication, we'll need the message
accompanying the error and carried by lib-jitsi-meet's
CONFERENCE_FAILED in the redux store. We already carry the message in
the redux action and we've got the error in the redux store.
master
paweldomas il y a 8 ans
Parent
révision
80329e8ffe

+ 4
- 3
react/features/base/connection/actions.native.js Voir le fichier

@@ -76,13 +76,14 @@ export function connect() {
76 76
          * Rejects external promise when connection fails.
77 77
          *
78 78
          * @param {JitsiConnectionErrors} err - Connection error.
79
+         * @param {string} msg - Error message supplied by lib-jitsi-meet.
79 80
          * @returns {void}
80 81
          * @private
81 82
          */
82
-        function _onConnectionFailed(err) {
83
+        function _onConnectionFailed(err, msg) {
83 84
             unsubscribe();
84
-            console.error('CONNECTION FAILED:', err);
85
-            dispatch(connectionFailed(connection, err));
85
+            console.error('CONNECTION FAILED:', err, msg);
86
+            dispatch(connectionFailed(connection, err, msg));
86 87
         }
87 88
 
88 89
         /**

+ 17
- 5
react/features/base/connection/reducer.js Voir le fichier

@@ -1,6 +1,6 @@
1 1
 /* @flow */
2 2
 
3
-import { assign, ReducerRegistry, set } from '../redux';
3
+import { assign, ReducerRegistry } from '../redux';
4 4
 import { parseURIString } from '../util';
5 5
 
6 6
 import {
@@ -75,7 +75,9 @@ function _connectionEstablished(
75 75
         { connection }: { connection: Object }) {
76 76
     return assign(state, {
77 77
         connecting: undefined,
78
-        connection
78
+        connection,
79
+        error: undefined,
80
+        errorMessage: undefined
79 81
     });
80 82
 }
81 83
 
@@ -91,14 +93,20 @@ function _connectionEstablished(
91 93
  */
92 94
 function _connectionFailed(
93 95
         state: Object,
94
-        { connection }: { connection: Object }) {
96
+        { connection, error, message }: {
97
+            connection: Object,
98
+            error: string,
99
+            message: ?string
100
+        }) {
95 101
     if (state.connection && state.connection !== connection) {
96 102
         return state;
97 103
     }
98 104
 
99 105
     return assign(state, {
100 106
         connecting: undefined,
101
-        connection: undefined
107
+        connection: undefined,
108
+        error,
109
+        errorMessage: message
102 110
     });
103 111
 }
104 112
 
@@ -115,7 +123,11 @@ function _connectionFailed(
115 123
 function _connectionWillConnect(
116 124
         state: Object,
117 125
         { connection }: { connection: Object }) {
118
-    return set(state, 'connecting', connection);
126
+    return assign(state, {
127
+        connecting: connection,
128
+        error: undefined,
129
+        errorMessage: undefined
130
+    });
119 131
 }
120 132
 
121 133
 /**

Chargement…
Annuler
Enregistrer