From 4018e8875fb1f50aa719b760aa70aab98441f321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 13 Oct 2022 11:53:15 +0200 Subject: [PATCH] fix(rn,screensharing) fix build --- react/features/base/tracks/actions.native.ts | 33 +++++++------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/react/features/base/tracks/actions.native.ts b/react/features/base/tracks/actions.native.ts index 896cfe692..3fbdd599a 100644 --- a/react/features/base/tracks/actions.native.ts +++ b/react/features/base/tracks/actions.native.ts @@ -20,31 +20,20 @@ export * from './actions.any'; * @returns {Function} */ export function toggleScreensharing(enabled: boolean): Function { - return (store: IStore) => _toggleScreenSharing(enabled, store); -} + return (dispatch: IStore['dispatch'], getState: IStore['getState']) => { + const state = getState(); -/** - * Toggles screen sharing. - * - * @private - * @param {boolean} enabled - The state to toggle screen sharing to. - * @param {Store} store - The redux. - * @returns {void} - */ -function _toggleScreenSharing(enabled: boolean, store: IStore): void { - const { dispatch, getState } = store; - const state = getState(); + if (enabled) { + const isSharing = isLocalVideoTrackDesktop(state); - if (enabled) { - const isSharing = isLocalVideoTrackDesktop(state); - - if (!isSharing) { - _startScreenSharing(dispatch, state); + if (!isSharing) { + _startScreenSharing(dispatch, state); + } + } else { + dispatch(destroyLocalDesktopTrackIfExists()); + setPictureInPictureEnabled(true); } - } else { - dispatch(destroyLocalDesktopTrackIfExists()); - setPictureInPictureEnabled(true); - } + }; } /**