|
|
@@ -1,6 +1,6 @@
|
|
1
|
1
|
import { setRoom } from '../base/conference';
|
|
2
|
|
-import { setLocationURL } from '../base/connection';
|
|
3
|
2
|
import { loadConfigError, setConfig } from '../base/config';
|
|
|
3
|
+import { setLocationURL } from '../base/connection';
|
|
4
|
4
|
import { loadConfig } from '../base/lib-jitsi-meet';
|
|
5
|
5
|
import { parseURIString } from '../base/util';
|
|
6
|
6
|
|
|
|
@@ -39,11 +39,14 @@ export function appNavigate(uri: ?string) {
|
|
39
|
39
|
function _appNavigateToMandatoryLocation(
|
|
40
|
40
|
dispatch: Dispatch<*>, getState: Function,
|
|
41
|
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
|
52
|
* Notifies that an attempt to load a configuration has completed. Due to
|
|
|
@@ -56,7 +59,7 @@ function _appNavigateToMandatoryLocation(
|
|
56
|
59
|
* loaded configuration.
|
|
57
|
60
|
* @returns {void}
|
|
58
|
61
|
*/
|
|
59
|
|
- function configLoaded(error, config) {
|
|
|
62
|
+ function loadConfigSettled(error, config) {
|
|
60
|
63
|
// FIXME Due to the asynchronous nature of the loading, the specified
|
|
61
|
64
|
// config may or may not be required by the time the notification
|
|
62
|
65
|
// arrives.
|
|
|
@@ -64,15 +67,15 @@ function _appNavigateToMandatoryLocation(
|
|
64
|
67
|
if (error) {
|
|
65
|
68
|
// XXX The failure could be, for example, because of a
|
|
66
|
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
|
81
|
return (
|
|
|
@@ -117,7 +120,7 @@ function _appNavigateToOptionalLocation(
|
|
117
|
120
|
|
|
118
|
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
|
/**
|