|
@@ -15,40 +15,28 @@ import UserMediaPermissionsFilmstripOnlyOverlay
|
15
|
15
|
import UserMediaPermissionsOverlay from './UserMediaPermissionsOverlay';
|
16
|
16
|
|
17
|
17
|
/**
|
18
|
|
- * Reference to the lazily loaded list of overlays.
|
|
18
|
+ * The lazily-initialized list of overlay React {@link Component} types used The
|
|
19
|
+ * user interface is filmstrip-only.
|
|
20
|
+ *
|
|
21
|
+ * XXX The value is meant to be compile-time defined so it does not contradict
|
|
22
|
+ * our coding style to not have global values that are runtime defined and
|
|
23
|
+ * merely works around side effects of circular imports.
|
|
24
|
+ *
|
|
25
|
+ * @type Array
|
19
|
26
|
*/
|
20
|
|
-let _overlays;
|
|
27
|
+let _filmstripOnlyOverlays;
|
21
|
28
|
|
22
|
29
|
/**
|
23
|
|
- * Returns the list of overlays which can be rendered by this container. The
|
24
|
|
- * list is lazily loaded the first time it's required.
|
|
30
|
+ * The lazily-initialized list of overlay React {@link Component} types used The
|
|
31
|
+ * user interface is not filmstrip-only.
|
25
|
32
|
*
|
26
|
|
- * @returns {Array} - The list of overlay types which are available.
|
|
33
|
+ * XXX The value is meant to be compile-time defined so it does not contradict
|
|
34
|
+ * our coding style to not have global values that are runtime defined and
|
|
35
|
+ * merely works around side effects of circular imports.
|
|
36
|
+ *
|
|
37
|
+ * @type Array
|
27
|
38
|
*/
|
28
|
|
-function getOverlays() {
|
29
|
|
- if (typeof _overlays === 'undefined') {
|
30
|
|
- const filmstripOnly
|
31
|
|
- = typeof interfaceConfig === 'object'
|
32
|
|
- && interfaceConfig.filmStripOnly;
|
33
|
|
-
|
34
|
|
- if (filmstripOnly) {
|
35
|
|
- _overlays = [
|
36
|
|
- PageReloadFilmstripOnlyOverlay,
|
37
|
|
- SuspendedFilmstripOnlyOverlay,
|
38
|
|
- UserMediaPermissionsFilmstripOnlyOverlay
|
39
|
|
- ];
|
40
|
|
- } else {
|
41
|
|
- _overlays = [
|
42
|
|
- PageReloadOverlay,
|
43
|
|
- SuspendedOverlay,
|
44
|
|
- UserMediaPermissionsOverlay,
|
45
|
|
- CallOverlay
|
46
|
|
- ];
|
47
|
|
- }
|
48
|
|
- }
|
49
|
|
-
|
50
|
|
- return _overlays;
|
51
|
|
-}
|
|
39
|
+let _nonFilmstripOnlyOverlays;
|
52
|
40
|
|
53
|
41
|
/**
|
54
|
42
|
* Implements a React {@link Component} that will display the correct overlay
|
|
@@ -81,6 +69,39 @@ class OverlayContainer extends Component {
|
81
|
69
|
}
|
82
|
70
|
}
|
83
|
71
|
|
|
72
|
+/**
|
|
73
|
+ * Returns the list of overlay React {@link Component} types to be rendered by
|
|
74
|
+ * {@code OverlayContainer}. The list is lazily initialized the first time it is
|
|
75
|
+ * required in order to works around side effects of circular imports.
|
|
76
|
+ *
|
|
77
|
+ * @param {boolean} filmstripOnly - The indicator which determines whether the
|
|
78
|
+ * user interface is filmstrip-only.
|
|
79
|
+ * @returns {Array} The list of overlay React {@code Component} types to be
|
|
80
|
+ * rendered by {@code OverlayContainer}.
|
|
81
|
+ */
|
|
82
|
+function _getOverlays(filmstripOnly) {
|
|
83
|
+ let overlays;
|
|
84
|
+
|
|
85
|
+ if (filmstripOnly) {
|
|
86
|
+ if (!(overlays = _filmstripOnlyOverlays)) {
|
|
87
|
+ overlays = _filmstripOnlyOverlays = [
|
|
88
|
+ PageReloadFilmstripOnlyOverlay,
|
|
89
|
+ SuspendedFilmstripOnlyOverlay,
|
|
90
|
+ UserMediaPermissionsFilmstripOnlyOverlay
|
|
91
|
+ ];
|
|
92
|
+ }
|
|
93
|
+ } else if (!(overlays = _nonFilmstripOnlyOverlays)) {
|
|
94
|
+ overlays = _nonFilmstripOnlyOverlays = [
|
|
95
|
+ PageReloadOverlay,
|
|
96
|
+ SuspendedOverlay,
|
|
97
|
+ UserMediaPermissionsOverlay,
|
|
98
|
+ CallOverlay
|
|
99
|
+ ];
|
|
100
|
+ }
|
|
101
|
+
|
|
102
|
+ return overlays;
|
|
103
|
+}
|
|
104
|
+
|
84
|
105
|
/**
|
85
|
106
|
* Maps (parts of) the redux state to the associated {@code OverlayContainer}'s
|
86
|
107
|
* props.
|
|
@@ -92,9 +113,14 @@ class OverlayContainer extends Component {
|
92
|
113
|
* }}
|
93
|
114
|
*/
|
94
|
115
|
function _mapStateToProps(state) {
|
|
116
|
+ // XXX In the future interfaceConfig is expected to not be a global variable
|
|
117
|
+ // but a redux state like config. Hence, the variable filmStripOnly
|
|
118
|
+ // naturally belongs here in preparation for the future.
|
|
119
|
+ const filmstripOnly
|
|
120
|
+ = typeof interfaceConfig === 'object' && interfaceConfig.filmStripOnly;
|
95
|
121
|
let overlay;
|
96
|
122
|
|
97
|
|
- for (const o of getOverlays()) {
|
|
123
|
+ for (const o of _getOverlays(filmstripOnly)) {
|
98
|
124
|
// react-i18n / react-redux wrap components and thus we cannot access
|
99
|
125
|
// the wrapped component's static methods directly.
|
100
|
126
|
const component = o.WrappedComponent || o;
|
|
@@ -107,7 +133,8 @@ function _mapStateToProps(state) {
|
107
|
133
|
|
108
|
134
|
return {
|
109
|
135
|
/**
|
110
|
|
- * Type of overlay that should be rendered.
|
|
136
|
+ * The React {@link Component} type of overlay to be rendered by the
|
|
137
|
+ * associated {@code OverlayContainer}.
|
111
|
138
|
*/
|
112
|
139
|
overlay
|
113
|
140
|
};
|