浏览代码

fix(toolbox): move default toolbox buttons logic to web only

toolbox/functions has functions that are specific only to web,
specifically defaultToolbarButtons. This has caused the native
build to attempt to bring in a web dependency which leads to a
build error. The fix for now is splitting web functions from
native functions to resolve the build error.
j8
Leonard Kim 8 年前
父节点
当前提交
48626ee71b

+ 0
- 18
react/features/toolbox/actions.native.js 查看文件

@@ -4,7 +4,6 @@ import type { Dispatch } from 'redux-thunk';
4 4
 
5 5
 import {
6 6
     CLEAR_TOOLBOX_TIMEOUT,
7
-    SET_DEFAULT_TOOLBOX_BUTTONS,
8 7
     SET_SUBJECT,
9 8
     SET_SUBJECT_SLIDE_IN,
10 9
     SET_TOOLBAR_BUTTON,
@@ -15,7 +14,6 @@ import {
15 14
     SET_TOOLBOX_TIMEOUT_MS,
16 15
     SET_TOOLBOX_VISIBLE
17 16
 } from './actionTypes';
18
-import { getDefaultToolboxButtons } from './functions';
19 17
 
20 18
 /**
21 19
  * Event handler for local raise hand changed event.
@@ -70,22 +68,6 @@ export function setAudioIconEnabled(enabled: boolean = false): Function {
70 68
     };
71 69
 }
72 70
 
73
-/**
74
- * Sets the default toolbar buttons of the Toolbox.
75
- *
76
- * @returns {{
77
- *     type: SET_DEFAULT_TOOLBOX_BUTTONS,
78
- *     primaryToolbarButtons: Map,
79
- *     secondaryToolbarButtons: Map
80
- * }}
81
- */
82
-export function setDefaultToolboxButtons(): Object {
83
-    return {
84
-        type: SET_DEFAULT_TOOLBOX_BUTTONS,
85
-        ...getDefaultToolboxButtons()
86
-    };
87
-}
88
-
89 71
 /**
90 72
  * Signals that value of conference subject should be changed.
91 73
  *

+ 21
- 3
react/features/toolbox/actions.web.js 查看文件

@@ -3,8 +3,8 @@
3 3
 import Recording from '../../../modules/UI/recording/Recording';
4 4
 import SideContainerToggler
5 5
     from '../../../modules/UI/side_pannels/SideContainerToggler';
6
-import UIUtil from '../../../modules/UI/util/UIUtil';
7 6
 import UIEvents from '../../../service/UI/UIEvents';
7
+import UIUtil from '../../../modules/UI/util/UIUtil';
8 8
 
9 9
 import {
10 10
     clearToolboxTimeout,
@@ -15,14 +15,16 @@ import {
15 15
     setToolboxVisible,
16 16
     toggleToolbarButton
17 17
 } from './actions.native';
18
-
19
-export * from './actions.native';
18
+import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
19
+import { getDefaultToolboxButtons } from './functions';
20 20
 
21 21
 declare var $: Function;
22 22
 declare var APP: Object;
23 23
 declare var config: Object;
24 24
 declare var interfaceConfig: Object;
25 25
 
26
+export * from './actions.native';
27
+
26 28
 /**
27 29
  * Checks whether desktop sharing is enabled and whether
28 30
  * we have params to start automatically sharing.
@@ -109,6 +111,22 @@ export function hideToolbox(force: boolean = false): Function {
109 111
     };
110 112
 }
111 113
 
114
+/**
115
+ * Sets the default toolbar buttons of the Toolbox.
116
+ *
117
+ * @returns {{
118
+ *     type: SET_DEFAULT_TOOLBOX_BUTTONS,
119
+ *     primaryToolbarButtons: Map,
120
+ *     secondaryToolbarButtons: Map
121
+ * }}
122
+ */
123
+export function setDefaultToolboxButtons(): Object {
124
+    return {
125
+        type: SET_DEFAULT_TOOLBOX_BUTTONS,
126
+        ...getDefaultToolboxButtons()
127
+    };
128
+}
129
+
112 130
 /**
113 131
  * Signals that unclickable property of profile button should change its value.
114 132
  *

+ 102
- 0
react/features/toolbox/functions.native.js 查看文件

@@ -0,0 +1,102 @@
1
+/* @flow */
2
+
3
+import type { Dispatch } from 'redux';
4
+
5
+import { appNavigate } from '../app';
6
+import { toggleAudioMuted, toggleVideoMuted } from '../base/media';
7
+
8
+/**
9
+ * Maps (redux) actions to React component props.
10
+ *
11
+ * @param {Function} dispatch - Redux action dispatcher.
12
+ * @returns {{
13
+ *     _onHangup: Function,
14
+ *     _onToggleAudio: Function,
15
+ *     _onToggleVideo: Function
16
+ * }}
17
+ * @private
18
+ */
19
+export function abstractMapDispatchToProps(dispatch: Dispatch<*>): Object {
20
+    return {
21
+        /**
22
+         * Dispatches action to leave the current conference.
23
+         *
24
+         * @private
25
+         * @returns {void}
26
+         * @type {Function}
27
+         */
28
+        _onHangup() {
29
+            // XXX We don't know here which value is effectively/internally
30
+            // used when there's no valid room name to join. It isn't our
31
+            // business to know that anyway. The undefined value is our
32
+            // expression of (1) the lack of knowledge & (2) the desire to no
33
+            // longer have a valid room name to join.
34
+            return dispatch(appNavigate(undefined));
35
+        },
36
+
37
+        /**
38
+         * Dispatches an action to toggle the mute state of the
39
+         * audio/microphone.
40
+         *
41
+         * @private
42
+         * @returns {Object} - Dispatched action.
43
+         * @type {Function}
44
+         */
45
+        _onToggleAudio() {
46
+            return dispatch(toggleAudioMuted());
47
+        },
48
+
49
+        /**
50
+         * Dispatches an action to toggle the mute state of the video/camera.
51
+         *
52
+         * @private
53
+         * @returns {Object} - Dispatched action.
54
+         * @type {Function}
55
+         */
56
+        _onToggleVideo() {
57
+            return dispatch(toggleVideoMuted());
58
+        }
59
+    };
60
+}
61
+
62
+/**
63
+ * Maps parts of media state to component props.
64
+ *
65
+ * @param {Object} state - Redux state.
66
+ * @protected
67
+ * @returns {{
68
+ *     _audioMuted: boolean,
69
+ *     _videoMuted: boolean,
70
+ *     _visible: boolean
71
+ * }}
72
+ */
73
+export function abstractMapStateToProps(state: Object): Object {
74
+    const media = state['features/base/media'];
75
+    const { visible } = state['features/toolbox'];
76
+
77
+    return {
78
+        /**
79
+         * Flag showing that audio is muted.
80
+         *
81
+         * @protected
82
+         * @type {boolean}
83
+         */
84
+        _audioMuted: media.audio.muted,
85
+
86
+        /**
87
+         * Flag showing whether video is muted.
88
+         *
89
+         * @protected
90
+         * @type {boolean}
91
+         */
92
+        _videoMuted: media.video.muted,
93
+
94
+        /**
95
+         * Flag showing whether toolbox is visible.
96
+         *
97
+         * @protected
98
+         * @type {boolean}
99
+         */
100
+        _visible: visible
101
+    };
102
+}

react/features/toolbox/functions.js → react/features/toolbox/functions.web.js 查看文件

@@ -1,116 +1,15 @@
1
-/* @flow */
2
-
3 1
 import SideContainerToggler
4 2
     from '../../../modules/UI/side_pannels/SideContainerToggler';
5 3
 
6
-import { appNavigate } from '../app';
7
-import { toggleAudioMuted, toggleVideoMuted } from '../base/media';
8
-
9 4
 import defaultToolbarButtons from './defaultToolbarButtons';
10 5
 
11
-import type { Dispatch } from 'redux-thunk';
12
-
13 6
 type MapOfAttributes = { [key: string]: * };
14 7
 
15 8
 declare var $: Function;
16 9
 declare var AJS: Object;
17 10
 declare var interfaceConfig: Object;
18 11
 
19
-/**
20
- * Maps (redux) actions to React component props.
21
- *
22
- * @param {Function} dispatch - Redux action dispatcher.
23
- * @returns {{
24
- *     _onHangup: Function,
25
- *     _onToggleAudio: Function,
26
- *     _onToggleVideo: Function
27
- * }}
28
- * @private
29
- */
30
-export function abstractMapDispatchToProps(dispatch: Dispatch<*>): Object {
31
-    return {
32
-        /**
33
-         * Dispatches action to leave the current conference.
34
-         *
35
-         * @private
36
-         * @returns {void}
37
-         * @type {Function}
38
-         */
39
-        _onHangup() {
40
-            // XXX We don't know here which value is effectively/internally
41
-            // used when there's no valid room name to join. It isn't our
42
-            // business to know that anyway. The undefined value is our
43
-            // expression of (1) the lack of knowledge & (2) the desire to no
44
-            // longer have a valid room name to join.
45
-            return dispatch(appNavigate(undefined));
46
-        },
47
-
48
-        /**
49
-         * Dispatches an action to toggle the mute state of the
50
-         * audio/microphone.
51
-         *
52
-         * @private
53
-         * @returns {Object} - Dispatched action.
54
-         * @type {Function}
55
-         */
56
-        _onToggleAudio() {
57
-            return dispatch(toggleAudioMuted());
58
-        },
59
-
60
-        /**
61
-         * Dispatches an action to toggle the mute state of the video/camera.
62
-         *
63
-         * @private
64
-         * @returns {Object} - Dispatched action.
65
-         * @type {Function}
66
-         */
67
-        _onToggleVideo() {
68
-            return dispatch(toggleVideoMuted());
69
-        }
70
-    };
71
-}
72
-
73
-/**
74
- * Maps parts of media state to component props.
75
- *
76
- * @param {Object} state - Redux state.
77
- * @protected
78
- * @returns {{
79
- *     _audioMuted: boolean,
80
- *     _videoMuted: boolean,
81
- *     _visible: boolean
82
- * }}
83
- */
84
-export function abstractMapStateToProps(state: Object): Object {
85
-    const media = state['features/base/media'];
86
-    const { visible } = state['features/toolbox'];
87
-
88
-    return {
89
-        /**
90
-         * Flag showing that audio is muted.
91
-         *
92
-         * @protected
93
-         * @type {boolean}
94
-         */
95
-        _audioMuted: media.audio.muted,
96
-
97
-        /**
98
-         * Flag showing whether video is muted.
99
-         *
100
-         * @protected
101
-         * @type {boolean}
102
-         */
103
-        _videoMuted: media.video.muted,
104
-
105
-        /**
106
-         * Flag showing whether toolbox is visible.
107
-         *
108
-         * @protected
109
-         * @type {boolean}
110
-         */
111
-        _visible: visible
112
-    };
113
-}
12
+export { abstractMapStateToProps } from './functions.native';
114 13
 
115 14
 /* eslint-disable flowtype/space-before-type-colon */
116 15
 

正在加载...
取消
保存