Selaa lähdekoodia

Reactify mute remote participant (#2145)

* fix(remote-mute): Moves remote participant mute to react

* fix(translation): Removes unused strings

* [squash] Addressing comments
master
yanas 8 vuotta sitten
vanhempi
commit
db71de97af

+ 0
- 8
conference.js Näytä tiedosto

2165
             APP.UI.setSubject(subject);
2165
             APP.UI.setSubject(subject);
2166
         });
2166
         });
2167
 
2167
 
2168
-        APP.UI.addListener(UIEvents.USER_KICKED, id => {
2169
-            room.kickParticipant(id);
2170
-        });
2171
-
2172
-        APP.UI.addListener(UIEvents.REMOTE_AUDIO_MUTED, id => {
2173
-            room.muteParticipant(id);
2174
-        });
2175
-
2176
         APP.UI.addListener(UIEvents.AUTH_CLICKED, () => {
2168
         APP.UI.addListener(UIEvents.AUTH_CLICKED, () => {
2177
             AuthHandler.authenticate(room);
2169
             AuthHandler.authenticate(room);
2178
         });
2170
         });

+ 0
- 3
lang/main.json Näytä tiedosto

2
     "contactlist": "__count__ Member",
2
     "contactlist": "__count__ Member",
3
     "contactlist_plural": "__count__ Members",
3
     "contactlist_plural": "__count__ Members",
4
     "passwordSetRemotely": "set by another member",
4
     "passwordSetRemotely": "set by another member",
5
-    "connectionsettings": "Connection Settings",
6
     "poweredby": "powered by",
5
     "poweredby": "powered by",
7
-    "feedback": "Give us your feedback",
8
     "inviteUrlDefaultMsg": "Your conference is currently being created...",
6
     "inviteUrlDefaultMsg": "Your conference is currently being created...",
9
     "me": "me",
7
     "me": "me",
10
     "speaker": "Speaker",
8
     "speaker": "Speaker",
11
     "raisedHand": "Would like to speak",
9
     "raisedHand": "Would like to speak",
12
     "defaultNickname": "ex. Jane Pink",
10
     "defaultNickname": "ex. Jane Pink",
13
     "defaultLink": "e.g. __url__",
11
     "defaultLink": "e.g. __url__",
14
-    "callingName": "__name__",
15
     "audioOnly": {
12
     "audioOnly": {
16
         "audioOnly": "Audio only",
13
         "audioOnly": "Audio only",
17
         "featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"
14
         "featureToggleDisabled": "Toggling of __feature__ is disabled while in audio only mode"

+ 4
- 20
react/features/base/participants/middleware.js Näytä tiedosto

27
  * @returns {Function}
27
  * @returns {Function}
28
  */
28
  */
29
 MiddlewareRegistry.register(store => next => action => {
29
 MiddlewareRegistry.register(store => next => action => {
30
+    const { conference } = store.getState()['features/base/conference'];
31
+
30
     switch (action.type) {
32
     switch (action.type) {
31
     case CONFERENCE_JOINED:
33
     case CONFERENCE_JOINED:
32
         store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
34
         store.dispatch(localParticipantIdChanged(action.conference.myUserId()));
37
         break;
39
         break;
38
 
40
 
39
     case KICK_PARTICIPANT:
41
     case KICK_PARTICIPANT:
40
-        if (typeof APP !== 'undefined') {
41
-            APP.UI.emitEvent(UIEvents.USER_KICKED, action.id);
42
-        }
42
+        conference.kickParticipant(action.id);
43
         break;
43
         break;
44
 
44
 
45
     case MUTE_REMOTE_PARTICIPANT:
45
     case MUTE_REMOTE_PARTICIPANT:
46
-        if (typeof APP !== 'undefined') {
47
-            APP.UI.messageHandler.openTwoButtonDialog({
48
-                titleKey: 'dialog.muteParticipantTitle',
49
-                msgString:
50
-                    '<div data-i18n="dialog.muteParticipantBody"></div>',
51
-                leftButtonKey: 'dialog.muteParticipantButton',
52
-                dontShowAgain: {
53
-                    id: 'dontShowMuteParticipantDialog',
54
-                    textKey: 'dialog.doNotShowMessageAgain',
55
-                    checked: true,
56
-                    buttonValues: [ true ]
57
-                },
58
-                submitFunction: () => {
59
-                    APP.UI.emitEvent(UIEvents.REMOTE_AUDIO_MUTED, action.id);
60
-                }
61
-            });
62
-        }
46
+        conference.muteParticipant(action.id);
63
         break;
47
         break;
64
 
48
 
65
     // TODO Remove this middleware when the local display name update flow is
49
     // TODO Remove this middleware when the local display name update flow is

+ 3
- 2
react/features/remote-video-menu/components/MuteButton.js Näytä tiedosto

4
 
4
 
5
 import { sendAnalyticsEvent } from '../../analytics';
5
 import { sendAnalyticsEvent } from '../../analytics';
6
 import { translate } from '../../base/i18n';
6
 import { translate } from '../../base/i18n';
7
-import { muteRemoteParticipant } from '../../base/participants';
7
+import { openDialog } from '../../base/dialog';
8
 
8
 
9
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
9
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
10
+import MuteRemoteParticipantDialog from './MuteRemoteParticipantDialog';
10
 
11
 
11
 /**
12
 /**
12
  * Implements a React {@link Component} which displays a button for audio muting
13
  * Implements a React {@link Component} which displays a button for audio muting
105
             }
106
             }
106
         );
107
         );
107
 
108
 
108
-        dispatch(muteRemoteParticipant(participantID));
109
+        dispatch(openDialog(MuteRemoteParticipantDialog, { participantID }));
109
 
110
 
110
         if (onClick) {
111
         if (onClick) {
111
             onClick();
112
             onClick();

+ 0
- 0
react/features/remote-video-menu/components/MuteRemoteParticipantDialog.native.js Näytä tiedosto


+ 114
- 0
react/features/remote-video-menu/components/MuteRemoteParticipantDialog.web.js Näytä tiedosto

1
+import PropTypes from 'prop-types';
2
+import React, { Component } from 'react';
3
+import { connect } from 'react-redux';
4
+
5
+import { Dialog } from '../../base/dialog';
6
+import { translate } from '../../base/i18n';
7
+
8
+import { sendAnalyticsEvent } from '../../analytics';
9
+import { muteRemoteParticipant } from '../../base/participants';
10
+
11
+/**
12
+ * A React Component with the contents for a dialog that asks for confirmation
13
+ * from the user before muting a remote participant.
14
+ *
15
+ * @extends Component
16
+ */
17
+class MuteRemoteParticipantDialog extends Component {
18
+    /**
19
+     * {@code MuteRemoteParticipantDialog} component's property types.
20
+     *
21
+     * @static
22
+     */
23
+    static propTypes = {
24
+        /**
25
+         * Invoked to send a request for muting the participant with the passed
26
+         * in participantID.
27
+         */
28
+        dispatch: PropTypes.func,
29
+
30
+        /**
31
+         * The ID of the participant linked to the onClick callback.
32
+         */
33
+        participantID: PropTypes.string,
34
+
35
+        /**
36
+         * Invoked to obtain translated strings.
37
+         */
38
+        t: PropTypes.func
39
+    };
40
+
41
+    /**
42
+     * Initializes a new {@code MuteRemoteParticipantDialog} instance.
43
+     *
44
+     * @param {Object} props - The read-only properties with which the new
45
+     * instance is to be initialized.
46
+     */
47
+    constructor(props) {
48
+        super(props);
49
+
50
+        // Bind event handlers so they are only bound once per instance.
51
+        this._onSubmit = this._onSubmit.bind(this);
52
+        this._renderContent = this._renderContent.bind(this);
53
+    }
54
+
55
+    /**
56
+     * Implements React's {@link Component#render()}.
57
+     *
58
+     * @inheritdoc
59
+     * @returns {ReactElement}
60
+     */
61
+    render() {
62
+        return (
63
+            <Dialog
64
+                okTitleKey = 'dialog.muteParticipantButton'
65
+                onSubmit = { this._onSubmit }
66
+                titleKey = 'dialog.muteParticipantTitle'
67
+                width = 'small'>
68
+                { this._renderContent() }
69
+            </Dialog>
70
+        );
71
+    }
72
+
73
+    /**
74
+     * Handles the submit button action.
75
+     *
76
+     * @private
77
+     * @returns {void}
78
+     */
79
+    _onSubmit() {
80
+        const { dispatch, participantID } = this.props;
81
+
82
+        sendAnalyticsEvent(
83
+            'remotevideomenu.mute.confirmed',
84
+            {
85
+                value: 1,
86
+                label: participantID
87
+            }
88
+        );
89
+
90
+        dispatch(muteRemoteParticipant(participantID));
91
+
92
+        return true;
93
+    }
94
+
95
+    /**
96
+     * Renders the content of the dialog.
97
+     *
98
+     * @returns {Component} the react component, which is the view of the dialog
99
+     * content
100
+     * @private
101
+     */
102
+    _renderContent() {
103
+        const { t } = this.props;
104
+
105
+        return (
106
+            <div>
107
+                { t('dialog.muteParticipantBody') }
108
+            </div>
109
+        );
110
+    }
111
+
112
+}
113
+
114
+export default translate(connect()(MuteRemoteParticipantDialog));

+ 0
- 2
service/UI/UIEvents.js Näytä tiedosto

34
      * current video playing time.
34
      * current video playing time.
35
      */
35
      */
36
     UPDATE_SHARED_VIDEO: 'UI.update_shared_video',
36
     UPDATE_SHARED_VIDEO: 'UI.update_shared_video',
37
-    USER_KICKED: 'UI.user_kicked',
38
-    REMOTE_AUDIO_MUTED: 'UI.remote_audio_muted',
39
     TOGGLE_FULLSCREEN: 'UI.toogle_fullscreen',
37
     TOGGLE_FULLSCREEN: 'UI.toogle_fullscreen',
40
     FULLSCREEN_TOGGLED: 'UI.fullscreen_toggled',
38
     FULLSCREEN_TOGGLED: 'UI.fullscreen_toggled',
41
     AUTH_CLICKED: 'UI.auth_clicked',
39
     AUTH_CLICKED: 'UI.auth_clicked',

Loading…
Peruuta
Tallenna