|
@@ -1,10 +1,13 @@
|
1
|
|
-/* global APP */
|
|
1
|
+/* @flow */
|
2
|
2
|
|
3
|
3
|
import { RouteRegistry } from '../base/react';
|
4
|
4
|
|
5
|
5
|
import { WelcomePage } from './components';
|
6
|
6
|
import { generateRoomWithoutSeparator } from './roomnameGenerator';
|
7
|
7
|
|
|
8
|
+declare var APP: Object;
|
|
9
|
+declare var config: Object;
|
|
10
|
+
|
8
|
11
|
/**
|
9
|
12
|
* Register route for WelcomePage.
|
10
|
13
|
*/
|
|
@@ -24,7 +27,20 @@ RouteRegistry.register({
|
24
|
27
|
* @returns {void}
|
25
|
28
|
*/
|
26
|
29
|
function onEnter(nextState, replace) {
|
27
|
|
- if (typeof APP !== 'undefined' && !APP.settings.isWelcomePageEnabled()) {
|
|
30
|
+ // The disabling of the Welcome page by redirecting to a random room name is
|
|
31
|
+ // a feature (1) we have on Web/React and (2) we do not want on mobile/React
|
|
32
|
+ // Native (at the time of this writing).
|
|
33
|
+ if (typeof APP === 'object'
|
|
34
|
+
|
|
35
|
+ // TODO Technically, there is features/base/config now so it is
|
|
36
|
+ // preferable to read config(uration) values from there and not rely
|
|
37
|
+ // on a global variable. However, the redux store is not available
|
|
38
|
+ // here at the time of this writing. Given the current (1) Web
|
|
39
|
+ // exclusivity of the feature and (2) the reliance on other global
|
|
40
|
+ // variables (e.g. APP), go with the global variable for now in
|
|
41
|
+ // order to minimize the effort involved.
|
|
42
|
+ && !(config.enableWelcomePage
|
|
43
|
+ && APP.settings.isWelcomePageEnabled())) {
|
28
|
44
|
const room = generateRoomWithoutSeparator();
|
29
|
45
|
|
30
|
46
|
replace(`/${room}`);
|