Browse Source

fix(toolbox) don't mix web and native actions on the same file

master
Saúl Ibarra Corretgé 4 years ago
parent
commit
b1ebe340cf

+ 55
- 0
react/features/toolbox/actions.any.js View File

@@ -0,0 +1,55 @@
1
+// @flow
2
+
3
+import {
4
+    SET_TOOLBOX_ALWAYS_VISIBLE,
5
+    SET_TOOLBOX_ENABLED,
6
+    SET_TOOLBOX_VISIBLE
7
+} from './actionTypes';
8
+
9
+/**
10
+ * Signals that always visible toolbars value should be changed.
11
+ *
12
+ * @param {boolean} alwaysVisible - Value to be set in redux store.
13
+ * @returns {{
14
+ *     type: SET_TOOLBOX_ALWAYS_VISIBLE,
15
+ *     alwaysVisible: boolean
16
+ * }}
17
+ */
18
+export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
19
+    return {
20
+        type: SET_TOOLBOX_ALWAYS_VISIBLE,
21
+        alwaysVisible
22
+    };
23
+}
24
+
25
+/**
26
+ * Enables/disables the toolbox.
27
+ *
28
+ * @param {boolean} enabled - True to enable the toolbox or false to disable it.
29
+ * @returns {{
30
+ *     type: SET_TOOLBOX_ENABLED,
31
+ *     enabled: boolean
32
+ * }}
33
+ */
34
+export function setToolboxEnabled(enabled: boolean): Object {
35
+    return {
36
+        type: SET_TOOLBOX_ENABLED,
37
+        enabled
38
+    };
39
+}
40
+
41
+/**
42
+ * Shows/hides the toolbox.
43
+ *
44
+ * @param {boolean} visible - True to show the toolbox or false to hide it.
45
+ * @returns {{
46
+ *     type: SET_TOOLBOX_VISIBLE,
47
+ *     visible: boolean
48
+ * }}
49
+ */
50
+export function setToolboxVisible(visible: boolean): Object {
51
+    return {
52
+        type: SET_TOOLBOX_VISIBLE,
53
+        visible
54
+    };
55
+}

+ 3
- 145
react/features/toolbox/actions.native.js View File

@@ -1,150 +1,8 @@
1
-/* @flow */
1
+// @flow
2 2
 
3
-import {
4
-    CLEAR_TOOLBOX_TIMEOUT,
5
-    SET_OVERFLOW_MENU_VISIBLE,
6
-    SET_TOOLBAR_HOVERED,
7
-    SET_TOOLBOX_ALWAYS_VISIBLE,
8
-    SET_TOOLBOX_ENABLED,
9
-    SET_TOOLBOX_TIMEOUT,
10
-    SET_TOOLBOX_TIMEOUT_MS,
11
-    SET_TOOLBOX_VISIBLE,
12
-    TOGGLE_TOOLBOX_VISIBLE
13
-} from './actionTypes';
3
+import { TOGGLE_TOOLBOX_VISIBLE } from './actionTypes';
14 4
 
15
-
16
-/**
17
- * Signals that toolbox timeout should be cleared.
18
- *
19
- * @returns {{
20
- *     type: CLEAR_TOOLBOX_TIMEOUT
21
- * }}
22
- */
23
-export function clearToolboxTimeout(): Object {
24
-    return {
25
-        type: CLEAR_TOOLBOX_TIMEOUT
26
-    };
27
-}
28
-
29
-/**
30
- * Shows/hides the overflow menu.
31
- *
32
- * @param {boolean} visible - True to show it or false to hide it.
33
- * @returns {{
34
- *     type: SET_OVERFLOW_MENU_VISIBLE,
35
- *     visible: boolean
36
- * }}
37
- */
38
-export function setOverflowMenuVisible(visible: boolean): Object {
39
-    return {
40
-        type: SET_OVERFLOW_MENU_VISIBLE,
41
-        visible
42
-    };
43
-}
44
-
45
-/**
46
- * Signals that toolbar is hovered value should be changed.
47
- *
48
- * @param {boolean} hovered - Flag showing whether toolbar is hovered.
49
- * @returns {{
50
- *     type: SET_TOOLBAR_HOVERED,
51
- *     hovered: boolean
52
- * }}
53
- */
54
-export function setToolbarHovered(hovered: boolean): Object {
55
-    return {
56
-        type: SET_TOOLBAR_HOVERED,
57
-        hovered
58
-    };
59
-}
60
-
61
-/**
62
- * Signals that always visible toolbars value should be changed.
63
- *
64
- * @param {boolean} alwaysVisible - Value to be set in redux store.
65
- * @returns {{
66
- *     type: SET_TOOLBOX_ALWAYS_VISIBLE,
67
- *     alwaysVisible: boolean
68
- * }}
69
- */
70
-export function setToolboxAlwaysVisible(alwaysVisible: boolean): Object {
71
-    return {
72
-        type: SET_TOOLBOX_ALWAYS_VISIBLE,
73
-        alwaysVisible
74
-    };
75
-}
76
-
77
-/* eslint-disable flowtype/space-before-type-colon */
78
-
79
-/**
80
- * Enables/disables the toolbox.
81
- *
82
- * @param {boolean} enabled - True to enable the toolbox or false to disable it.
83
- * @returns {{
84
- *     type: SET_TOOLBOX_ENABLED,
85
- *     enabled: boolean
86
- * }}
87
- */
88
-export function setToolboxEnabled(enabled: boolean): Object {
89
-    return {
90
-        type: SET_TOOLBOX_ENABLED,
91
-        enabled
92
-    };
93
-}
94
-
95
-/**
96
- * Dispatches an action which sets new timeout and clears the previous one.
97
- *
98
- * @param {Function} handler - Function to be invoked after the timeout.
99
- * @param {number} timeoutMS - Delay.
100
- * @returns {{
101
- *     type: SET_TOOLBOX_TIMEOUT,
102
- *     handler: Function,
103
- *     timeoutMS: number
104
- * }}
105
- */
106
-export function setToolboxTimeout(handler: Function, timeoutMS: number)
107
-      : Object {
108
-    return {
109
-        type: SET_TOOLBOX_TIMEOUT,
110
-        handler,
111
-        timeoutMS
112
-    };
113
-}
114
-
115
-/* eslint-enable flowtype/space-before-type-colon */
116
-
117
-/**
118
- * Dispatches an action which sets new toolbox timeout value.
119
- *
120
- * @param {number} timeoutMS - Delay.
121
- * @returns {{
122
- *     type: SET_TOOLBOX_TIMEOUT_MS,
123
- *     timeoutMS: number
124
- * }}
125
- */
126
-export function setToolboxTimeoutMS(timeoutMS: number): Object {
127
-    return {
128
-        type: SET_TOOLBOX_TIMEOUT_MS,
129
-        timeoutMS
130
-    };
131
-}
132
-
133
-/**
134
- * Shows/hides the toolbox.
135
- *
136
- * @param {boolean} visible - True to show the toolbox or false to hide it.
137
- * @returns {{
138
- *     type: SET_TOOLBOX_VISIBLE,
139
- *     visible: boolean
140
- * }}
141
- */
142
-export function setToolboxVisible(visible: boolean): Object {
143
-    return {
144
-        type: SET_TOOLBOX_VISIBLE,
145
-        visible
146
-    };
147
-}
5
+export * from './actions.any';
148 6
 
149 7
 /**
150 8
  * Action to toggle the toolbox visibility.

+ 88
- 9
react/features/toolbox/actions.web.js View File

@@ -5,20 +5,20 @@ import type { Dispatch } from 'redux';
5 5
 import { isLayoutTileView } from '../video-layout';
6 6
 
7 7
 import {
8
+    CLEAR_TOOLBOX_TIMEOUT,
8 9
     FULL_SCREEN_CHANGED,
9 10
     SET_FULL_SCREEN,
10
-    SET_OVERFLOW_DRAWER
11
+    SET_OVERFLOW_DRAWER,
12
+    SET_OVERFLOW_MENU_VISIBLE,
13
+    SET_TOOLBAR_HOVERED,
14
+    SET_TOOLBOX_TIMEOUT,
15
+    SET_TOOLBOX_TIMEOUT_MS
11 16
 } from './actionTypes';
12
-import {
13
-    clearToolboxTimeout,
14
-    setToolboxTimeout,
15
-    setToolboxTimeoutMS,
16
-    setToolboxVisible
17
-} from './actions.native';
17
+import { setToolboxVisible } from './actions.any';
18 18
 
19 19
 declare var interfaceConfig: Object;
20 20
 
21
-export * from './actions.native';
21
+export * from './actions.any';
22 22
 
23 23
 /**
24 24
  * Docks/undocks the Toolbox.
@@ -180,9 +180,88 @@ export function hideToolboxOnTileView() {
180 180
         const state = getState();
181 181
         const { overflowDrawer } = state['features/toolbox'];
182 182
 
183
-
184 183
         if (!overflowDrawer && isLayoutTileView(state)) {
185 184
             dispatch(hideToolbox(true));
186 185
         }
187 186
     };
188 187
 }
188
+
189
+/**
190
+ * Signals that toolbox timeout should be cleared.
191
+ *
192
+ * @returns {{
193
+ *     type: CLEAR_TOOLBOX_TIMEOUT
194
+ * }}
195
+ */
196
+export function clearToolboxTimeout(): Object {
197
+    return {
198
+        type: CLEAR_TOOLBOX_TIMEOUT
199
+    };
200
+}
201
+
202
+/**
203
+ * Shows/hides the overflow menu.
204
+ *
205
+ * @param {boolean} visible - True to show it or false to hide it.
206
+ * @returns {{
207
+ *     type: SET_OVERFLOW_MENU_VISIBLE,
208
+ *     visible: boolean
209
+ * }}
210
+ */
211
+export function setOverflowMenuVisible(visible: boolean): Object {
212
+    return {
213
+        type: SET_OVERFLOW_MENU_VISIBLE,
214
+        visible
215
+    };
216
+}
217
+
218
+/**
219
+ * Signals that toolbar is hovered value should be changed.
220
+ *
221
+ * @param {boolean} hovered - Flag showing whether toolbar is hovered.
222
+ * @returns {{
223
+ *     type: SET_TOOLBAR_HOVERED,
224
+ *     hovered: boolean
225
+ * }}
226
+ */
227
+export function setToolbarHovered(hovered: boolean): Object {
228
+    return {
229
+        type: SET_TOOLBAR_HOVERED,
230
+        hovered
231
+    };
232
+}
233
+
234
+/**
235
+ * Dispatches an action which sets new timeout and clears the previous one.
236
+ *
237
+ * @param {Function} handler - Function to be invoked after the timeout.
238
+ * @param {number} timeoutMS - Delay.
239
+ * @returns {{
240
+ *     type: SET_TOOLBOX_TIMEOUT,
241
+ *     handler: Function,
242
+ *     timeoutMS: number
243
+ * }}
244
+ */
245
+export function setToolboxTimeout(handler: Function, timeoutMS: number): Object {
246
+    return {
247
+        type: SET_TOOLBOX_TIMEOUT,
248
+        handler,
249
+        timeoutMS
250
+    };
251
+}
252
+
253
+/**
254
+ * Dispatches an action which sets new toolbox timeout value.
255
+ *
256
+ * @param {number} timeoutMS - Delay.
257
+ * @returns {{
258
+ *     type: SET_TOOLBOX_TIMEOUT_MS,
259
+ *     timeoutMS: number
260
+ * }}
261
+ */
262
+export function setToolboxTimeoutMS(timeoutMS: number): Object {
263
+    return {
264
+        type: SET_TOOLBOX_TIMEOUT_MS,
265
+        timeoutMS
266
+    };
267
+}

Loading…
Cancel
Save