Skip to content

Commit

Permalink
feat(toolbox): moved action to appropriate feature and fixed naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinteodor committed Aug 9, 2024
1 parent ce22adf commit cbad2a6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 47 deletions.
11 changes: 0 additions & 11 deletions react/features/mobile/external-api/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
25 changes: 1 addition & 24 deletions react/features/mobile/external-api/actions.ts
Original file line number Diff line number Diff line change
@@ -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';


/**
Expand Down Expand Up @@ -35,22 +31,3 @@ export function setParticipantsWithScreenShare(participantIds: Array<string>) {
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
};
}
14 changes: 3 additions & 11 deletions react/features/mobile/external-api/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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.
Expand Down Expand Up @@ -199,7 +191,7 @@ externalAPIEnabled && MiddlewareRegistry.register(store => next => action => {

sendEvent(
store,
CUSTOM_MENU_BUTTON_PRESSED,
CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED,
{
id,
text
Expand Down
11 changes: 11 additions & 0 deletions react/features/toolbox/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 21 additions & 0 deletions react/features/toolbox/actions.native.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CUSTOM_OVERFLOW_MENU_BUTTON_PRESSED } from './actionTypes';

export * from './actions.any';

/**
Expand All @@ -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
};
}
2 changes: 1 addition & 1 deletion react/features/toolbox/components/native/OverflowMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down

0 comments on commit cbad2a6

Please sign in to comment.