|
@@ -24,16 +24,27 @@ export function appInit() {
|
24
|
24
|
* Triggers an in-app navigation to a different route. Allows navigation to be
|
25
|
25
|
* abstracted between the mobile and web versions.
|
26
|
26
|
*
|
27
|
|
- * @param {(string|undefined)} urlOrRoom - The URL or room name to which to
|
28
|
|
- * navigate.
|
|
27
|
+ * @param {(string|undefined)} uri - The URI to which to navigate. It may be a
|
|
28
|
+ * full URL with an http(s) scheme, a full or partial URI with the app-specific
|
|
29
|
+ * sheme, or a mere room name.
|
29
|
30
|
* @returns {Function}
|
30
|
31
|
*/
|
31
|
|
-export function appNavigate(urlOrRoom) {
|
|
32
|
+export function appNavigate(uri) {
|
32
|
33
|
return (dispatch, getState) => {
|
33
|
34
|
const state = getState();
|
34
|
35
|
const oldDomain = getDomain(state);
|
35
|
36
|
|
36
|
|
- const { domain, room } = _parseURIString(urlOrRoom);
|
|
37
|
+ // eslint-disable-next-line prefer-const
|
|
38
|
+ let { domain, room } = _parseURIString(uri);
|
|
39
|
+
|
|
40
|
+ // If the specified URI does not identify a domain, use the app's
|
|
41
|
+ // default.
|
|
42
|
+ if (typeof domain === 'undefined') {
|
|
43
|
+ domain
|
|
44
|
+ = _parseURIString(state['features/app'].app._getDefaultURL())
|
|
45
|
+ .domain;
|
|
46
|
+
|
|
47
|
+ }
|
37
|
48
|
|
38
|
49
|
// TODO Kostiantyn Tsaregradskyi: We should probably detect if user is
|
39
|
50
|
// currently in a conference and ask her if she wants to close the
|
|
@@ -48,7 +59,7 @@ export function appNavigate(urlOrRoom) {
|
48
|
59
|
dispatch(setDomain(domain));
|
49
|
60
|
|
50
|
61
|
// If domain has changed, we need to load the config of the new
|
51
|
|
- // domain and set it, and only after that we can navigate to
|
|
62
|
+ // domain and set it, and only after that we can navigate to a
|
52
|
63
|
// different route.
|
53
|
64
|
loadConfig(`https://${domain}`)
|
54
|
65
|
.then(
|
|
@@ -92,7 +103,7 @@ export function appNavigate(urlOrRoom) {
|
92
|
103
|
dispatch(
|
93
|
104
|
_setRoomAndNavigate(
|
94
|
105
|
typeof room === 'undefined' && typeof domain === 'undefined'
|
95
|
|
- ? urlOrRoom
|
|
106
|
+ ? uri
|
96
|
107
|
: room));
|
97
|
108
|
}
|
98
|
109
|
};
|