Browse Source

fix(shared-video): Remove disable button action from web.

factor2
damencho 5 months ago
parent
commit
50d0092e30

+ 1
- 1
modules/API/API.js View File

115
 import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
115
 import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
116
 import SettingsDialog from '../../react/features/settings/components/web/SettingsDialog';
116
 import SettingsDialog from '../../react/features/settings/components/web/SettingsDialog';
117
 import { SETTINGS_TABS } from '../../react/features/settings/constants';
117
 import { SETTINGS_TABS } from '../../react/features/settings/constants';
118
-import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions.any';
118
+import { playSharedVideo, stopSharedVideo } from '../../react/features/shared-video/actions';
119
 import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
119
 import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
120
 import { setRequestingSubtitles, toggleRequestingSubtitles } from '../../react/features/subtitles/actions';
120
 import { setRequestingSubtitles, toggleRequestingSubtitles } from '../../react/features/subtitles/actions';
121
 import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';
121
 import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';

+ 0
- 11
react/features/shared-video/actionTypes.ts View File

28
  */
28
  */
29
 export const SET_CONFIRM_SHOW_VIDEO = 'SET_CONFIRM_SHOW_VIDEO';
29
 export const SET_CONFIRM_SHOW_VIDEO = 'SET_CONFIRM_SHOW_VIDEO';
30
 
30
 
31
-
32
-/**
33
- * The type of the action which signals to disable or enable the shared video
34
- * button.
35
- *
36
- * {
37
- *     type: SET_DISABLE_BUTTON
38
- * }
39
- */
40
-export const SET_DISABLE_BUTTON = 'SET_DISABLE_BUTTON';
41
-
42
 /**
31
 /**
43
  * The type of the action which sets an array of whitelisted urls.
32
  * The type of the action which sets an array of whitelisted urls.
44
  *
33
  *

+ 0
- 1
react/features/shared-video/actions.native.ts View File

1
-export * from './actions.any';

react/features/shared-video/actions.any.ts → react/features/shared-video/actions.ts View File


+ 0
- 19
react/features/shared-video/actions.web.ts View File

1
-import { SET_DISABLE_BUTTON } from './actionTypes';
2
-
3
-export * from './actions.any';
4
-
5
-/**
6
- * Disabled share video button.
7
- *
8
- * @param {boolean} disabled - The current state of the share video button.
9
- * @returns {{
10
- *     type: SET_DISABLE_BUTTON,
11
- *     disabled: boolean
12
- * }}
13
- */
14
-export function setDisableButton(disabled: boolean) {
15
-    return {
16
-        type: SET_DISABLE_BUTTON,
17
-        disabled
18
-    };
19
-}

+ 1
- 1
react/features/shared-video/components/native/AbstractVideoManager.ts View File

5
 import { getCurrentConference } from '../../../base/conference/functions';
5
 import { getCurrentConference } from '../../../base/conference/functions';
6
 import { IJitsiConference } from '../../../base/conference/reducer';
6
 import { IJitsiConference } from '../../../base/conference/reducer';
7
 import { getLocalParticipant } from '../../../base/participants/functions';
7
 import { getLocalParticipant } from '../../../base/participants/functions';
8
-import { setSharedVideoStatus } from '../../actions.any';
8
+import { setSharedVideoStatus } from '../../actions';
9
 import { PLAYBACK_STATUSES } from '../../constants';
9
 import { PLAYBACK_STATUSES } from '../../constants';
10
 
10
 
11
 /**
11
 /**

+ 1
- 1
react/features/shared-video/components/native/SharedVideoButton.ts View File

7
 import { IconPlay } from '../../../base/icons/svg';
7
 import { IconPlay } from '../../../base/icons/svg';
8
 import { getLocalParticipant } from '../../../base/participants/functions';
8
 import { getLocalParticipant } from '../../../base/participants/functions';
9
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
9
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
10
-import { toggleSharedVideo } from '../../actions.native';
10
+import { toggleSharedVideo } from '../../actions';
11
 import { isSharingStatus } from '../../functions';
11
 import { isSharingStatus } from '../../functions';
12
 
12
 
13
 /**
13
 /**

+ 1
- 1
react/features/shared-video/components/web/AbstractVideoManager.ts View File

15
 import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications/constants';
15
 import { NOTIFICATION_TIMEOUT_TYPE } from '../../../notifications/constants';
16
 import { dockToolbox } from '../../../toolbox/actions';
16
 import { dockToolbox } from '../../../toolbox/actions';
17
 import { muteLocal } from '../../../video-menu/actions.any';
17
 import { muteLocal } from '../../../video-menu/actions.any';
18
-import { setSharedVideoStatus, stopSharedVideo } from '../../actions.any';
18
+import { setSharedVideoStatus, stopSharedVideo } from '../../actions';
19
 import { PLAYBACK_STATUSES } from '../../constants';
19
 import { PLAYBACK_STATUSES } from '../../constants';
20
 
20
 
21
 const logger = Logger.getLogger(__filename);
21
 const logger = Logger.getLogger(__filename);

+ 7
- 8
react/features/shared-video/components/web/SharedVideoButton.ts View File

3
 import { IReduxState } from '../../../app/types';
3
 import { IReduxState } from '../../../app/types';
4
 import { translate } from '../../../base/i18n/functions';
4
 import { translate } from '../../../base/i18n/functions';
5
 import { IconPlay } from '../../../base/icons/svg';
5
 import { IconPlay } from '../../../base/icons/svg';
6
+import { getLocalParticipant } from '../../../base/participants/functions';
6
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
7
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
7
-import { toggleSharedVideo } from '../../actions.any';
8
+import { toggleSharedVideo } from '../../actions';
8
 import { isSharingStatus } from '../../functions';
9
 import { isSharingStatus } from '../../functions';
9
 
10
 
10
 interface IProps extends AbstractButtonProps {
11
 interface IProps extends AbstractButtonProps {
83
  * @returns {IProps}
84
  * @returns {IProps}
84
  */
85
  */
85
 function _mapStateToProps(state: IReduxState) {
86
 function _mapStateToProps(state: IReduxState) {
86
-    const {
87
-        disabled: sharedVideoBtnDisabled,
88
-        status: sharedVideoStatus
89
-    } = state['features/shared-video'];
87
+    const { ownerId, status: sharedVideoStatus } = state['features/shared-video'];
88
+    const localParticipantId = getLocalParticipant(state)?.id;
89
+    const isSharing = isSharingStatus(sharedVideoStatus ?? '');
90
 
90
 
91
     return {
91
     return {
92
-        _isDisabled: Boolean(sharedVideoBtnDisabled),
93
-        _sharingVideo: isSharingStatus(sharedVideoStatus ?? '')
92
+        _isDisabled: isSharing && ownerId !== localParticipantId,
93
+        _sharingVideo: isSharing
94
     };
94
     };
95
 }
95
 }
96
 
96
 
97
-
98
 export default translate(connect(_mapStateToProps)(SharedVideoButton));
97
 export default translate(connect(_mapStateToProps)(SharedVideoButton));

+ 0
- 1
react/features/shared-video/middleware.native.ts View File

1
-import './middleware.any';

react/features/shared-video/middleware.any.ts → react/features/shared-video/middleware.ts View File

22
     setAllowedUrlDomians,
22
     setAllowedUrlDomians,
23
     setSharedVideoStatus,
23
     setSharedVideoStatus,
24
     showConfirmPlayingDialog
24
     showConfirmPlayingDialog
25
-} from './actions.any';
25
+} from './actions';
26
 import {
26
 import {
27
     DEFAULT_ALLOWED_URL_DOMAINS,
27
     DEFAULT_ALLOWED_URL_DOMAINS,
28
     PLAYBACK_START,
28
     PLAYBACK_START,

+ 0
- 41
react/features/shared-video/middleware.web.ts View File

1
-import { CONFERENCE_JOIN_IN_PROGRESS } from '../base/conference/actionTypes';
2
-import { getLocalParticipant } from '../base/participants/functions';
3
-import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
4
-
5
-import { setDisableButton } from './actions.web';
6
-import { PLAYBACK_STATUSES, SHARED_VIDEO } from './constants';
7
-import { isSharedVideoEnabled } from './functions';
8
-
9
-import './middleware.any';
10
-
11
-MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
12
-    const state = getState();
13
-    const localParticipantId = getLocalParticipant(state)?.id;
14
-
15
-    switch (action.type) {
16
-    case CONFERENCE_JOIN_IN_PROGRESS: {
17
-        if (!isSharedVideoEnabled(state)) {
18
-            break;
19
-        }
20
-
21
-        const { conference } = action;
22
-
23
-        conference.addCommandListener(SHARED_VIDEO, ({ attributes }: { attributes:
24
-            { from: string; state: string; }; }) => {
25
-            const { from } = attributes;
26
-            const status = attributes.state;
27
-
28
-            if (status === PLAYBACK_STATUSES.PLAYING) {
29
-                if (localParticipantId !== from) {
30
-                    dispatch(setDisableButton(true));
31
-                }
32
-            } else if (status === 'stop') {
33
-                dispatch(setDisableButton(false));
34
-            }
35
-        });
36
-        break;
37
-    }
38
-    }
39
-
40
-    return next(action);
41
-});

+ 1
- 9
react/features/shared-video/reducer.ts View File

4
     RESET_SHARED_VIDEO_STATUS,
4
     RESET_SHARED_VIDEO_STATUS,
5
     SET_ALLOWED_URL_DOMAINS,
5
     SET_ALLOWED_URL_DOMAINS,
6
     SET_CONFIRM_SHOW_VIDEO,
6
     SET_CONFIRM_SHOW_VIDEO,
7
-    SET_DISABLE_BUTTON,
8
     SET_SHARED_VIDEO_STATUS
7
     SET_SHARED_VIDEO_STATUS
9
 } from './actionTypes';
8
 } from './actionTypes';
10
 import { DEFAULT_ALLOWED_URL_DOMAINS } from './constants';
9
 import { DEFAULT_ALLOWED_URL_DOMAINS } from './constants';
16
 export interface ISharedVideoState {
15
 export interface ISharedVideoState {
17
     allowedUrlDomains: Array<string>;
16
     allowedUrlDomains: Array<string>;
18
     confirmShowVideo?: boolean;
17
     confirmShowVideo?: boolean;
19
-    disabled?: boolean;
20
     muted?: boolean;
18
     muted?: boolean;
21
     ownerId?: string;
19
     ownerId?: string;
22
     status?: string;
20
     status?: string;
30
  */
28
  */
31
 ReducerRegistry.register<ISharedVideoState>('features/shared-video',
29
 ReducerRegistry.register<ISharedVideoState>('features/shared-video',
32
 (state = initialState, action): ISharedVideoState => {
30
 (state = initialState, action): ISharedVideoState => {
33
-    const { videoUrl, status, time, ownerId, disabled, muted, volume } = action;
31
+    const { videoUrl, status, time, ownerId, muted, volume } = action;
34
 
32
 
35
     switch (action.type) {
33
     switch (action.type) {
36
     case RESET_SHARED_VIDEO_STATUS:
34
     case RESET_SHARED_VIDEO_STATUS:
55
             volume
53
             volume
56
         };
54
         };
57
 
55
 
58
-    case SET_DISABLE_BUTTON:
59
-        return {
60
-            ...state,
61
-            disabled
62
-        };
63
-
64
     case SET_ALLOWED_URL_DOMAINS: {
56
     case SET_ALLOWED_URL_DOMAINS: {
65
         return {
57
         return {
66
             ...state,
58
             ...state,

+ 1
- 1
react/features/video-menu/components/web/FakeParticipantContextMenu.tsx View File

9
 import { IParticipant } from '../../../base/participants/types';
9
 import { IParticipant } from '../../../base/participants/types';
10
 import ContextMenu from '../../../base/ui/components/web/ContextMenu';
10
 import ContextMenu from '../../../base/ui/components/web/ContextMenu';
11
 import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
11
 import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
12
-import { stopSharedVideo } from '../../../shared-video/actions.any';
12
+import { stopSharedVideo } from '../../../shared-video/actions';
13
 import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../toolbox/functions.web';
13
 import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../toolbox/functions.web';
14
 import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
14
 import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
15
 import { setWhiteboardOpen } from '../../../whiteboard/actions';
15
 import { setWhiteboardOpen } from '../../../whiteboard/actions';

Loading…
Cancel
Save