浏览代码

[RN] Report loadConfigError with locationURL to the SDK consumers

j8
Lyubo Marinov 8 年前
父节点
当前提交
fce0e4c22c

+ 4
- 2
android/README.md 查看文件

244
 
244
 
245
 #### onLoadConfigError
245
 #### onLoadConfigError
246
 
246
 
247
-Called when loading the main configuration fails.
247
+Called when loading the main configuration file from the Jitsi Meet deployment
248
+fails.
248
 
249
 
249
-The `data` `Map` contains an "error" key with the error.
250
+The `data` `Map` contains an "error" key with the error and a "url" key with the
251
+conference URL which necessitated the loading of the configuration file.

+ 5
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java 查看文件

60
     void onConferenceWillLeave(Map<String, Object> data);
60
     void onConferenceWillLeave(Map<String, Object> data);
61
 
61
 
62
     /**
62
     /**
63
-     * Called when loading the main configuration fails.
63
+     * Called when loading the main configuration file from the Jitsi Meet
64
+     * deployment fails.
64
      *
65
      *
65
-     * @param data - Map with an "error" key with the error.
66
+     * @param data - Map with an "error" key with the error and a "url" key with
67
+     * the conference URL which necessitated the loading of the configuration
68
+     * file.
66
      */
69
      */
67
     void onLoadConfigError(Map<String, Object> data);
70
     void onLoadConfigError(Map<String, Object> data);
68
 }
71
 }

+ 5
- 2
ios/README.md 查看文件

153
 
153
 
154
 #### loadConfigError
154
 #### loadConfigError
155
 
155
 
156
-Called when loading the main configuration fails.
156
+Called when loading the main configuration file from the Jitsi Meet deployment
157
+fails.
157
 
158
 
158
-The `data` dictionary contains an "error" key with the error.
159
+The `data` dictionary contains an "error" key with the error and a "url" key
160
+with the conference URL which necessitated the loading of the configuration
161
+file.

+ 5
- 2
ios/sdk/src/JitsiMeetViewDelegate.h 查看文件

60
 - (void)conferenceWillLeave:(NSDictionary *)data;
60
 - (void)conferenceWillLeave:(NSDictionary *)data;
61
 
61
 
62
 /**
62
 /**
63
- * Called when loading the main configuration file fails.
63
+ * Called when loading the main configuration file from the Jitsi Meet
64
+ * deployment file.
64
  *
65
  *
65
- * The {@code data} dictionary contains an {@code error} key with the error.
66
+ * The {@code data} dictionary contains an {@code error} key with the error and
67
+ * a {@code url} key with the conference URL which necessitated the loading of
68
+ * the configuration file.
66
  */
69
  */
67
 - (void)loadConfigError:(NSDictionary *)data;
70
 - (void)loadConfigError:(NSDictionary *)data;
68
 
71
 

+ 18
- 15
react/features/app/actions.js 查看文件

1
 import { setRoom } from '../base/conference';
1
 import { setRoom } from '../base/conference';
2
-import { setLocationURL } from '../base/connection';
3
 import { loadConfigError, setConfig } from '../base/config';
2
 import { loadConfigError, setConfig } from '../base/config';
3
+import { setLocationURL } from '../base/connection';
4
 import { loadConfig } from '../base/lib-jitsi-meet';
4
 import { loadConfig } from '../base/lib-jitsi-meet';
5
 import { parseURIString } from '../base/util';
5
 import { parseURIString } from '../base/util';
6
 
6
 
39
 function _appNavigateToMandatoryLocation(
39
 function _appNavigateToMandatoryLocation(
40
         dispatch: Dispatch<*>, getState: Function,
40
         dispatch: Dispatch<*>, getState: Function,
41
         newLocation: Object) {
41
         newLocation: Object) {
42
-    _loadConfig(newLocation)
43
-        .then(
44
-            config => configLoaded(/* err */ undefined, config),
45
-            err => configLoaded(err, /* config */ undefined))
46
-        .then(() => dispatch(setRoom(newLocation.room)));
42
+    const { room } = newLocation;
43
+
44
+    return (
45
+        _loadConfig(newLocation)
46
+            .then(
47
+                config => loadConfigSettled(/* error */ undefined, config),
48
+                error => loadConfigSettled(error, /* config */ undefined))
49
+            .then(() => dispatch(setRoom(room))));
47
 
50
 
48
     /**
51
     /**
49
      * Notifies that an attempt to load a configuration has completed. Due to
52
      * Notifies that an attempt to load a configuration has completed. Due to
56
      * loaded configuration.
59
      * loaded configuration.
57
      * @returns {void}
60
      * @returns {void}
58
      */
61
      */
59
-    function configLoaded(error, config) {
62
+    function loadConfigSettled(error, config) {
60
         // FIXME Due to the asynchronous nature of the loading, the specified
63
         // FIXME Due to the asynchronous nature of the loading, the specified
61
         // config may or may not be required by the time the notification
64
         // config may or may not be required by the time the notification
62
         // arrives.
65
         // arrives.
64
         if (error) {
67
         if (error) {
65
             // XXX The failure could be, for example, because of a
68
             // XXX The failure could be, for example, because of a
66
             // certificate-related error. In which case the connection will
69
             // certificate-related error. In which case the connection will
67
-            // fail later in Strophe anyway even if we use the default
68
-            // config here.
69
-            dispatch(loadConfigError(error));
70
+            // fail later in Strophe anyway.
71
+            dispatch(loadConfigError(error, newLocation));
70
 
72
 
71
-            // We cannot go to the requested room if we weren't able to load
72
-            // the configuration. Go back to the entryway.
73
-            newLocation.room = undefined;
73
+            // Cannot go to a room if its configuration failed to load.
74
+            if (room) {
75
+                dispatch(appNavigate(undefined));
74
 
76
 
75
-            return;
77
+                throw error;
78
+            }
76
         }
79
         }
77
 
80
 
78
         return (
81
         return (
117
 
120
 
118
     location.protocol || (location.protocol = 'https:');
121
     location.protocol || (location.protocol = 'https:');
119
 
122
 
120
-    _appNavigateToMandatoryLocation(dispatch, getState, location);
123
+    return _appNavigateToMandatoryLocation(dispatch, getState, location);
121
 }
124
 }
122
 
125
 
123
 /**
126
 /**

+ 4
- 3
react/features/base/config/actionTypes.js 查看文件

1
 /**
1
 /**
2
- * The redux action which signals the configuration couldn't be loaded due to an
3
- * error.
2
+ * The redux action which signals that a configuration could not be loaded due
3
+ * to a specific error.
4
  *
4
  *
5
  * {
5
  * {
6
  *     type: LOAD_CONFIG_ERROR,
6
  *     type: LOAD_CONFIG_ERROR,
7
- *     error: Error
7
+ *     error: Error,
8
+ *     locationURL: string | URL
8
  * }
9
  * }
9
  */
10
  */
10
 export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR');
11
 export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR');

+ 11
- 6
react/features/base/config/actions.js 查看文件

3
 import { LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
3
 import { LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
4
 
4
 
5
 /**
5
 /**
6
- * Signals an error when loading the configuration.
6
+ * Signals that a configuration could not be loaded due to a specific error.
7
  *
7
  *
8
- * @param {Error} error - The error which caused the config to not be loaded.
8
+ * @param {Error} error - The {@code Error} which prevented the successful
9
+ * loading of a configuration.
10
+ * @param {string|URL} locationURL - The URL of the location which necessitated
11
+ * the loading of a configuration.
9
  * @returns {{
12
  * @returns {{
10
- *      type: LOAD_CONFIG_ERROR,
11
- *      error: Error
13
+ *     type: LOAD_CONFIG_ERROR,
14
+ *     error: Error,
15
+ *     locationURL
12
  * }}
16
  * }}
13
  */
17
  */
14
-export function loadConfigError(error: Error) {
18
+export function loadConfigError(error: Error, locationURL: string | URL) {
15
     return {
19
     return {
16
         type: LOAD_CONFIG_ERROR,
20
         type: LOAD_CONFIG_ERROR,
17
-        error
21
+        error,
22
+        locationURL
18
     };
23
     };
19
 }
24
 }
20
 
25
 

+ 6
- 1
react/features/base/util/uri.js 查看文件

382
 
382
 
383
         if (domain) {
383
         if (domain) {
384
             const { host, hostname, pathname: contextRoot, port }
384
             const { host, hostname, pathname: contextRoot, port }
385
-                = parseStandardURIString(domain);
385
+                = parseStandardURIString(
386
+
387
+                    // XXX The value of domain in supposed to be host/hostname
388
+                    // and, optionally, pathname. Make sure it is not taken for
389
+                    // a pathname only.
390
+                    _fixURIStringScheme(`org.jitsi.meet://${domain}`));
386
 
391
 
387
             // authority
392
             // authority
388
             if (host) {
393
             if (host) {

+ 6
- 10
react/features/mobile/external-api/middleware.js 查看文件

39
             data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
39
             data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
40
         }
40
         }
41
 
41
 
42
-        // The (externa API) event's name is the string representation of the
43
-        // (redux) action's type.
44
-        const name = _getSymbolDescription(type);
45
-
46
-        _sendEvent(store, name, data);
42
+        _sendEvent(store, _getSymbolDescription(type), data);
47
         break;
43
         break;
48
     }
44
     }
49
 
45
 
50
     case LOAD_CONFIG_ERROR: {
46
     case LOAD_CONFIG_ERROR: {
51
-        const { type, error } = action;
47
+        const { error, locationURL, type } = action;
52
 
48
 
53
-        _sendEvent(
54
-            store,
55
-            _getSymbolDescription(type),
56
-            { error: String(error) });
49
+        _sendEvent(store, _getSymbolDescription(type), {
50
+            error: String(error),
51
+            url: toURLString(locationURL)
52
+        });
57
         break;
53
         break;
58
     }
54
     }
59
     }
55
     }

正在加载...
取消
保存