Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(toolbox): move default toolbox buttons logic to web only
Leonard Kim48626ee71beb
diff --git a/react/features/toolbox/actions.native.js b/react/features/toolbox/actions.native.jsindex 7e3b3e2d11..f550712d65 100644--- a/react/features/toolbox/actions.native.js+++ b/react/features/toolbox/actions.native.js@@ -4,7 +4,6 @@ import type { Dispatch } from 'redux-thunk';import {CLEAR_TOOLBOX_TIMEOUT,- SET_DEFAULT_TOOLBOX_BUTTONS,SET_SUBJECT,SET_SUBJECT_SLIDE_IN,SET_TOOLBAR_BUTTON,@@ -15,7 +14,6 @@ import {SET_TOOLBOX_TIMEOUT_MS,SET_TOOLBOX_VISIBLE} from './actionTypes';-import { getDefaultToolboxButtons } from './functions';/*** Event handler for local raise hand changed event.@@ -70,22 +68,6 @@ export function setAudioIconEnabled(enabled: boolean = false): Function {};}-/**- * Sets the default toolbar buttons of the Toolbox.- *- * @returns {{- * type: SET_DEFAULT_TOOLBOX_BUTTONS,- * primaryToolbarButtons: Map,- * secondaryToolbarButtons: Map- * }}- */-export function setDefaultToolboxButtons(): Object {- return {- type: SET_DEFAULT_TOOLBOX_BUTTONS,- ...getDefaultToolboxButtons()- };-}-/*** Signals that value of conference subject should be changed.*diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.jsindex 39d284eb3e..efcb1d40fe 100644--- a/react/features/toolbox/actions.web.js+++ b/react/features/toolbox/actions.web.js@@ -3,8 +3,8 @@import Recording from '../../../modules/UI/recording/Recording';import SideContainerTogglerfrom '../../../modules/UI/side_pannels/SideContainerToggler';-import UIUtil from '../../../modules/UI/util/UIUtil';import UIEvents from '../../../service/UI/UIEvents';+import UIUtil from '../../../modules/UI/util/UIUtil';import {clearToolboxTimeout,@@ -15,14 +15,16 @@ import {setToolboxVisible,toggleToolbarButton} from './actions.native';--export * from './actions.native';+import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';+import { getDefaultToolboxButtons } from './functions';declare var $: Function;declare var APP: Object;declare var config: Object;declare var interfaceConfig: Object;+export * from './actions.native';+/*** Checks whether desktop sharing is enabled and whether* we have params to start automatically sharing.@@ -109,6 +111,22 @@ export function hideToolbox(force: boolean = false): Function {};}+/**+ * Sets the default toolbar buttons of the Toolbox.+ *+ * @returns {{+ * type: SET_DEFAULT_TOOLBOX_BUTTONS,+ * primaryToolbarButtons: Map,+ * secondaryToolbarButtons: Map+ * }}+ */+export function setDefaultToolboxButtons(): Object {+ return {+ type: SET_DEFAULT_TOOLBOX_BUTTONS,+ ...getDefaultToolboxButtons()+ };+}+/*** Signals that unclickable property of profile button should change its value.*diff --git a/react/features/toolbox/functions.native.js b/react/features/toolbox/functions.native.jsnew file mode 100644index 0000000000..70277956a1--- /dev/null+++ b/react/features/toolbox/functions.native.js@@ -0,0 +1,102 @@+/* @flow */++import type { Dispatch } from 'redux';++import { appNavigate } from '../app';+import { toggleAudioMuted, toggleVideoMuted } from '../base/media';++/**+ * Maps (redux) actions to React component props.+ *+ * @param {Function} dispatch - Redux action dispatcher.+ * @returns {{+ * _onHangup: Function,+ * _onToggleAudio: Function,+ * _onToggleVideo: Function+ * }}+ * @private+ */+export function abstractMapDispatchToProps(dispatch: Dispatch<*>): Object {+ return {+ /**+ * Dispatches action to leave the current conference.+ *+ * @private+ * @returns {void}+ * @type {Function}+ */+ _onHangup() {+ // XXX We don't know here which value is effectively/internally+ // used when there's no valid room name to join. It isn't our+ // business to know that anyway. The undefined value is our+ // expression of (1) the lack of knowledge & (2) the desire to no+ // longer have a valid room name to join.+ return dispatch(appNavigate(undefined));+ },++ /**+ * Dispatches an action to toggle the mute state of the+ * audio/microphone.+ *+ * @private+ * @returns {Object} - Dispatched action.+ * @type {Function}+ */+ _onToggleAudio() {+ return dispatch(toggleAudioMuted());+ },++ /**+ * Dispatches an action to toggle the mute state of the video/camera.+ *+ * @private+ * @returns {Object} - Dispatched action.+ * @type {Function}+ */+ _onToggleVideo() {+ return dispatch(toggleVideoMuted());+ }+ };+}++/**+ * Maps parts of media state to component props.+ *+ * @param {Object} state - Redux state.+ * @protected+ * @returns {{+ * _audioMuted: boolean,+ * _videoMuted: boolean,+ * _visible: boolean+ * }}+ */+export function abstractMapStateToProps(state: Object): Object {+ const media = state['features/base/media'];+ const { visible } = state['features/toolbox'];++ return {+ /**+ * Flag showing that audio is muted.+ *+ * @protected+ * @type {boolean}+ */+ _audioMuted: media.audio.muted,++ /**+ * Flag showing whether video is muted.+ *+ * @protected+ * @type {boolean}+ */+ _videoMuted: media.video.muted,++ /**+ * Flag showing whether toolbox is visible.+ *+ * @protected+ * @type {boolean}+ */+ _visible: visible+ };+}diff --git a/react/features/toolbox/functions.js b/react/features/toolbox/functions.web.jssimilarity index 65%rename from react/features/toolbox/functions.jsrename to react/features/toolbox/functions.web.jsindex f2d1edbf60..e127645916 100644--- a/react/features/toolbox/functions.js+++ b/react/features/toolbox/functions.web.js@@ -1,116 +1,15 @@-/* @flow */-import SideContainerTogglerfrom '../../../modules/UI/side_pannels/SideContainerToggler';-import { appNavigate } from '../app';-import { toggleAudioMuted, toggleVideoMuted } from '../base/media';-import defaultToolbarButtons from './defaultToolbarButtons';-import type { Dispatch } from 'redux-thunk';-type MapOfAttributes = { [key: string]: * };declare var $: Function;declare var AJS: Object;declare var interfaceConfig: Object;-/**- * Maps (redux) actions to React component props.- *- * @param {Function} dispatch - Redux action dispatcher.- * @returns {{- * _onHangup: Function,- * _onToggleAudio: Function,- * _onToggleVideo: Function- * }}- * @private- */-export function abstractMapDispatchToProps(dispatch: Dispatch<*>): Object {- return {- /**- * Dispatches action to leave the current conference.- *- * @private- * @returns {void}- * @type {Function}- */- _onHangup() {- // XXX We don't know here which value is effectively/internally- // used when there's no valid room name to join. It isn't our- // business to know that anyway. The undefined value is our- // expression of (1) the lack of knowledge & (2) the desire to no- // longer have a valid room name to join.- return dispatch(appNavigate(undefined));- },-- /**- * Dispatches an action to toggle the mute state of the- * audio/microphone.- *- * @private- * @returns {Object} - Dispatched action.- * @type {Function}- */- _onToggleAudio() {- return dispatch(toggleAudioMuted());- },-- /**- * Dispatches an action to toggle the mute state of the video/camera.- *- * @private- * @returns {Object} - Dispatched action.- * @type {Function}- */- _onToggleVideo() {- return dispatch(toggleVideoMuted());- }- };-}--/**- * Maps parts of media state to component props.- *- * @param {Object} state - Redux state.- * @protected- * @returns {{- * _audioMuted: boolean,- * _videoMuted: boolean,- * _visible: boolean- * }}- */-export function abstractMapStateToProps(state: Object): Object {- const media = state['features/base/media'];- const { visible } = state['features/toolbox'];-- return {- /**- * Flag showing that audio is muted.- *- * @protected- * @type {boolean}- */- _audioMuted: media.audio.muted,-- /**- * Flag showing whether video is muted.- *- * @protected- * @type {boolean}- */- _videoMuted: media.video.muted,-- /**- * Flag showing whether toolbox is visible.- *- * @protected- * @type {boolean}- */- _visible: visible- };-}+export { abstractMapStateToProps } from './functions.native';/* eslint-disable flowtype/space-before-type-colon */