From 2d2bae6ec1f1318d2ad1c5db0ab9b7762e5d8ee2 Mon Sep 17 00:00:00 2001 From: Calin-Teodor Date: Fri, 9 Aug 2024 15:46:47 +0300 Subject: [PATCH] feat(toolbox): moved action to appropriate feature and fixed naming --- .../mobile/external-api/actionTypes.ts | 11 -------- react/features/mobile/external-api/actions.ts | 25 +------------------ .../mobile/external-api/middleware.ts | 14 +++-------- react/features/toolbox/actionTypes.ts | 11 ++++++++ react/features/toolbox/actions.native.ts | 21 ++++++++++++++++ .../components/native/OverflowMenu.tsx | 2 +- 6 files changed, 37 insertions(+), 47 deletions(-) diff --git a/react/features/mobile/external-api/actionTypes.ts b/react/features/mobile/external-api/actionTypes.ts index a672e62177e..8f1964170db 100644 --- a/react/features/mobile/external-api/actionTypes.ts +++ b/react/features/mobile/external-api/actionTypes.ts @@ -18,14 +18,3 @@ export const READY_TO_CLOSE = 'READY_TO_CLOSE'; */ export const SCREEN_SHARE_PARTICIPANTS_UPDATED = 'SCREEN_SHARE_PARTICIPANTS_UPDATED'; - -/** - * The type of (redux) action which signals that a custom button from the overflow menu was pressed. - * - * @returns {{ - * type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, - * id: string, - * text: string - * }} - */ -export const CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED = 'CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED'; diff --git a/react/features/mobile/external-api/actions.ts b/react/features/mobile/external-api/actions.ts index 7614062e222..d9f951583ac 100644 --- a/react/features/mobile/external-api/actions.ts +++ b/react/features/mobile/external-api/actions.ts @@ -1,8 +1,4 @@ -import { - CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, - READY_TO_CLOSE, - SCREEN_SHARE_PARTICIPANTS_UPDATED -} from './actionTypes'; +import { READY_TO_CLOSE, SCREEN_SHARE_PARTICIPANTS_UPDATED } from './actionTypes'; /** @@ -35,22 +31,3 @@ export function setParticipantsWithScreenShare(participantIds: Array) { participantIds }; } - -/** - * Creates a (redux) action which that a custom overflow menu button was pressed. - * - * @param {string} id - The id for the custom button. - * @param {string} text - The label for the custom button. - * @returns {{ - * type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, - * id: string, - * text: string - * }} - */ -export function customOverflowMenuButtonPressed(id: string, text: string) { - return { - type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, - id, - text - }; -} diff --git a/react/features/mobile/external-api/middleware.ts b/react/features/mobile/external-api/middleware.ts index 7c1c1f6798d..2ddf5d9fd61 100644 --- a/react/features/mobile/external-api/middleware.ts +++ b/react/features/mobile/external-api/middleware.ts @@ -52,15 +52,13 @@ import { ITrack } from '../../base/tracks/types'; import { CLOSE_CHAT, OPEN_CHAT } from '../../chat/actionTypes'; import { closeChat, openChat, sendMessage, setPrivateMessageRecipient } from '../../chat/actions.native'; import { setRequestingSubtitles } from '../../subtitles/actions.any'; +import { CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED } from '../../toolbox/actionTypes'; import { muteLocal } from '../../video-menu/actions.native'; import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture/actionTypes'; // @ts-ignore import { isExternalAPIAvailable } from '../react-native-sdk/functions'; -import { - CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, - READY_TO_CLOSE -} from './actionTypes'; +import { READY_TO_CLOSE } from './actionTypes'; import { setParticipantsWithScreenShare } from './actions'; import { participantToParticipantInfo, sendEvent } from './functions'; import logger from './logger'; @@ -82,12 +80,6 @@ const CHAT_TOGGLED = 'CHAT_TOGGLED'; */ const CONFERENCE_TERMINATED = 'CONFERENCE_TERMINATED'; -/** - * Event which will be emitted on the native side to indicate that the custom overflow menu button was pressed. - */ -const CUSTOM_MENU_BUTTON_PRESSED = 'CUSTOM_MENU_BUTTON_PRESSED'; - - /** * Event which will be emitted on the native side to indicate a message was received * through the channel. @@ -199,7 +191,7 @@ externalAPIEnabled && MiddlewareRegistry.register(store => next => action => { sendEvent( store, - CUSTOM_MENU_BUTTON_PRESSED, + CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, { id, text diff --git a/react/features/toolbox/actionTypes.ts b/react/features/toolbox/actionTypes.ts index a594298df70..7803a1169e2 100644 --- a/react/features/toolbox/actionTypes.ts +++ b/react/features/toolbox/actionTypes.ts @@ -7,6 +7,17 @@ */ export const CLEAR_TOOLBOX_TIMEOUT = 'CLEAR_TOOLBOX_TIMEOUT'; +/** + * The type of (redux) action which signals that a custom button from the overflow menu was pressed. + * + * @returns {{ + * type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, + * id: string, + * text: string + * }} + */ +export const CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED = 'CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED'; + /** * The type of (redux) action which updates whether the conference is or is not * currently in full screen view. diff --git a/react/features/toolbox/actions.native.ts b/react/features/toolbox/actions.native.ts index 7f84c5637ff..568d9320c22 100644 --- a/react/features/toolbox/actions.native.ts +++ b/react/features/toolbox/actions.native.ts @@ -1,3 +1,5 @@ +import { CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED } from './actionTypes'; + export * from './actions.any'; /** @@ -22,3 +24,22 @@ export function showToolbox(_timeout?: number): any { export function setOverflowMenuVisible(_visible: boolean): any { return {}; } + +/** + * Creates a (redux) action which that a custom overflow menu button was pressed. + * + * @param {string} id - The id for the custom button. + * @param {string} text - The label for the custom button. + * @returns {{ + * type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, + * id: string, + * text: string + * }} + */ +export function customOverflowMenuButtonPressed(id: string, text: string) { + return { + type: CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED, + id, + text + }; +} diff --git a/react/features/toolbox/components/native/OverflowMenu.tsx b/react/features/toolbox/components/native/OverflowMenu.tsx index 480ba5dbeca..4186a434744 100644 --- a/react/features/toolbox/components/native/OverflowMenu.tsx +++ b/react/features/toolbox/components/native/OverflowMenu.tsx @@ -11,7 +11,6 @@ import SettingsButton from '../../../base/settings/components/native/SettingsBut import BreakoutRoomsButton from '../../../breakout-rooms/components/native/BreakoutRoomsButton'; import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton.native'; -import { customOverflowMenuButtonPressed } from '../../../mobile/external-api/actions'; import ReactionMenu from '../../../reactions/components/native/ReactionMenu'; import { shouldDisplayReactionsButtons } from '../../../reactions/functions.any'; import LiveStreamButton from '../../../recording/components/LiveStream/native/LiveStreamButton'; @@ -25,6 +24,7 @@ import ClosedCaptionButton from '../../../subtitles/components/native/ClosedCapt import TileViewButton from '../../../video-layout/components/TileViewButton'; import styles from '../../../video-menu/components/native/styles'; import WhiteboardButton from '../../../whiteboard/components/native/WhiteboardButton'; +import { customOverflowMenuButtonPressed } from '../../actions.native'; import { getMovableButtons } from '../../functions.native'; import AudioOnlyButton from './AudioOnlyButton';