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(av-moderation): block native screen share when moderation is on
Calin-Teodore17f286e8976
diff --git a/react/features/base/tracks/actions.native.ts b/react/features/base/tracks/actions.native.tsindex c9a500b377..4069f6c38b 100644--- a/react/features/base/tracks/actions.native.ts+++ b/react/features/base/tracks/actions.native.ts@@ -1,4 +1,7 @@import { IReduxState, IStore } from '../../app/types';+import { showModeratedNotification } from '../../av-moderation/actions';+import { MEDIA_TYPE as AVM_MEDIA_TYPE } from '../../av-moderation/constants';+import { shouldShowModeratedNotification } from '../../av-moderation/functions';import { showNotification } from '../../notifications/actions';import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';import JitsiMeetJS from '../lib-jitsi-meet';@@ -23,6 +26,13 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignorreturn (dispatch: IStore['dispatch'], getState: IStore['getState']) => {const state = getState();+ // check for A/V Moderation when trying to start screen sharing+ if (enabled && shouldShowModeratedNotification(AVM_MEDIA_TYPE.DESKTOP, state)) {+ dispatch(showModeratedNotification(AVM_MEDIA_TYPE.DESKTOP));++ return;+ }+if (enabled) {_startScreenSharing(dispatch, state);} else {diff --git a/react/features/toolbox/components/native/ScreenSharingIosButton.tsx b/react/features/toolbox/components/native/ScreenSharingIosButton.tsxindex 5fb949f923..a8347bbba7 100644--- a/react/features/toolbox/components/native/ScreenSharingIosButton.tsx+++ b/react/features/toolbox/components/native/ScreenSharingIosButton.tsx@@ -4,6 +4,9 @@ import { ScreenCapturePickerView } from 'react-native-webrtc';import { connect } from 'react-redux';import { IReduxState } from '../../../app/types';+import { showModeratedNotification } from '../../../av-moderation/actions';+import { MEDIA_TYPE as AVM_MEDIA_TYPE } from '../../../av-moderation/constants';+import { shouldShowModeratedNotification } from '../../../av-moderation/functions';import { IOS_SCREENSHARING_ENABLED } from '../../../base/flags/constants';import { getFeatureFlag } from '../../../base/flags/functions';import { translate } from '../../../base/i18n/functions.native';@@ -21,6 +24,11 @@ interface IProps extends AbstractButtonProps {*/_disabled: boolean;+ /**+ * Whether screen-share moderation blocks starting a screen share.+ */+ _moderated: boolean;+/*** Whether video is currently muted or not.*/@@ -97,6 +105,15 @@ class ScreenSharingIosButton extends AbstractButton<IProps> {* @returns {void}*/override _handleClick() {+ const { _moderated, dispatch } = this.props;++ // The broadcast picker starts the share outside of redux, so check A/V Moderation before it opens.+ if (_moderated) {+ dispatch(showModeratedNotification(AVM_MEDIA_TYPE.DESKTOP));++ return;+ }+const handle = findNodeHandle(this._nativeComponent);NativeModules.ScreenCapturePickerViewManager.show(handle);@@ -136,9 +153,11 @@ class ScreenSharingIosButton extends AbstractButton<IProps> {*/function _mapStateToProps(state: IReduxState) {const enabled = getFeatureFlag(state, IOS_SCREENSHARING_ENABLED, false);+ const _screensharing = isLocalVideoTrackDesktop(state);return {- _screensharing: isLocalVideoTrackDesktop(state),+ _moderated: !_screensharing && shouldShowModeratedNotification(AVM_MEDIA_TYPE.DESKTOP, state),+ _screensharing,// TODO: this should work on iOS 12 too, but our trick to show the picker doesn't work.visible: enabled