Przeglądaj źródła

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

factor2
damencho 5 miesięcy temu
rodzic
commit
50d0092e30

+ 1
- 1
modules/API/API.js Wyświetl plik

@@ -115,7 +115,7 @@ import { toggleScreenshotCaptureSummary } from '../../react/features/screenshot-
115 115
 import { isScreenshotCaptureEnabled } from '../../react/features/screenshot-capture/functions';
116 116
 import SettingsDialog from '../../react/features/settings/components/web/SettingsDialog';
117 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 119
 import { extractYoutubeIdOrURL } from '../../react/features/shared-video/functions';
120 120
 import { setRequestingSubtitles, toggleRequestingSubtitles } from '../../react/features/subtitles/actions';
121 121
 import { isAudioMuteButtonDisabled } from '../../react/features/toolbox/functions';

+ 0
- 11
react/features/shared-video/actionTypes.ts Wyświetl plik

@@ -28,17 +28,6 @@ export const RESET_SHARED_VIDEO_STATUS = 'RESET_SHARED_VIDEO_STATUS';
28 28
  */
29 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 32
  * The type of the action which sets an array of whitelisted urls.
44 33
  *

+ 0
- 1
react/features/shared-video/actions.native.ts Wyświetl plik

@@ -1 +0,0 @@
1
-export * from './actions.any';

react/features/shared-video/actions.any.ts → react/features/shared-video/actions.ts Wyświetl plik


+ 0
- 19
react/features/shared-video/actions.web.ts Wyświetl plik

@@ -1,19 +0,0 @@
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 Wyświetl plik

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

+ 1
- 1
react/features/shared-video/components/native/SharedVideoButton.ts Wyświetl plik

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

+ 1
- 1
react/features/shared-video/components/web/AbstractVideoManager.ts Wyświetl plik

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

+ 7
- 8
react/features/shared-video/components/web/SharedVideoButton.ts Wyświetl plik

@@ -3,8 +3,9 @@ import { connect } from 'react-redux';
3 3
 import { IReduxState } from '../../../app/types';
4 4
 import { translate } from '../../../base/i18n/functions';
5 5
 import { IconPlay } from '../../../base/icons/svg';
6
+import { getLocalParticipant } from '../../../base/participants/functions';
6 7
 import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
7
-import { toggleSharedVideo } from '../../actions.any';
8
+import { toggleSharedVideo } from '../../actions';
8 9
 import { isSharingStatus } from '../../functions';
9 10
 
10 11
 interface IProps extends AbstractButtonProps {
@@ -83,16 +84,14 @@ class SharedVideoButton extends AbstractButton<IProps> {
83 84
  * @returns {IProps}
84 85
  */
85 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 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 97
 export default translate(connect(_mapStateToProps)(SharedVideoButton));

+ 0
- 1
react/features/shared-video/middleware.native.ts Wyświetl plik

@@ -1 +0,0 @@
1
-import './middleware.any';

react/features/shared-video/middleware.any.ts → react/features/shared-video/middleware.ts Wyświetl plik

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

+ 0
- 41
react/features/shared-video/middleware.web.ts Wyświetl plik

@@ -1,41 +0,0 @@
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 Wyświetl plik

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

+ 1
- 1
react/features/video-menu/components/web/FakeParticipantContextMenu.tsx Wyświetl plik

@@ -9,7 +9,7 @@ import { isWhiteboardParticipant } from '../../../base/participants/functions';
9 9
 import { IParticipant } from '../../../base/participants/types';
10 10
 import ContextMenu from '../../../base/ui/components/web/ContextMenu';
11 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 13
 import { getParticipantMenuButtonsWithNotifyClick, showOverflowDrawer } from '../../../toolbox/functions.web';
14 14
 import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';
15 15
 import { setWhiteboardOpen } from '../../../whiteboard/actions';

Ładowanie…
Anuluj
Zapisz