Parcourir la source

Comply w/ coding style

j8
Lyubo Marinov il y a 8 ans
Parent
révision
0e9509ae9b

+ 15
- 9
react/features/base/conference/actions.js Voir le fichier

@@ -1,8 +1,8 @@
1 1
 import { JitsiConferenceEvents } from '../lib-jitsi-meet';
2 2
 import {
3
-    changeParticipantConnectionStatus,
4 3
     dominantSpeakerChanged,
5 4
     getLocalParticipant,
5
+    participantConnectionStatusChanged,
6 6
     participantJoined,
7 7
     participantLeft,
8 8
     participantRoleChanged,
@@ -39,6 +39,8 @@ import type { Dispatch } from 'redux';
39 39
  * @returns {void}
40 40
  */
41 41
 function _addConferenceListeners(conference, dispatch) {
42
+    // Dispatches into features/base/conference follow:
43
+
42 44
     conference.on(
43 45
             JitsiConferenceEvents.CONFERENCE_FAILED,
44 46
             (...args) => dispatch(conferenceFailed(conference, ...args)));
@@ -49,18 +51,12 @@ function _addConferenceListeners(conference, dispatch) {
49 51
             JitsiConferenceEvents.CONFERENCE_LEFT,
50 52
             (...args) => dispatch(conferenceLeft(conference, ...args)));
51 53
 
52
-    conference.on(
53
-            JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED,
54
-            (...args) => dispatch(dominantSpeakerChanged(...args)));
55
-
56
-    conference.on(
57
-        JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
58
-        (...args) => dispatch(changeParticipantConnectionStatus(...args)));
59
-
60 54
     conference.on(
61 55
             JitsiConferenceEvents.LOCK_STATE_CHANGED,
62 56
             (...args) => dispatch(_lockStateChanged(conference, ...args)));
63 57
 
58
+    // Dispatches into features/base/tracks follow:
59
+
64 60
     conference.on(
65 61
             JitsiConferenceEvents.TRACK_ADDED,
66 62
             t => t && !t.isLocal() && dispatch(trackAdded(t)));
@@ -68,6 +64,16 @@ function _addConferenceListeners(conference, dispatch) {
68 64
             JitsiConferenceEvents.TRACK_REMOVED,
69 65
             t => t && !t.isLocal() && dispatch(trackRemoved(t)));
70 66
 
67
+    // Dispatches into features/base/participants follow:
68
+
69
+    conference.on(
70
+            JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED,
71
+            (...args) => dispatch(dominantSpeakerChanged(...args)));
72
+
73
+    conference.on(
74
+            JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
75
+            (...args) => dispatch(participantConnectionStatusChanged(...args)));
76
+
71 77
     conference.on(
72 78
             JitsiConferenceEvents.USER_JOINED,
73 79
             (id, user) => dispatch(participantJoined({

+ 24
- 24
react/features/base/participants/actions.js Voir le fichier

@@ -8,30 +8,6 @@ import {
8 8
 } from './actionTypes';
9 9
 import { getLocalParticipant } from './functions';
10 10
 
11
-/**
12
- * Action to update a participant's connection status.
13
- *
14
- * @param {string} id - Participant's ID.
15
- * @param {string} connectionStatus - The new connection status for the
16
- * participant.
17
- * @returns {{
18
- *     type: PARTICIPANT_UPDATED,
19
- *     participant: {
20
- *         id: string,
21
- *         connectionStatus: string
22
- *     }
23
- * }}
24
- */
25
-export function changeParticipantConnectionStatus(id, connectionStatus) {
26
-    return {
27
-        type: PARTICIPANT_UPDATED,
28
-        participant: {
29
-            id,
30
-            connectionStatus
31
-        }
32
-    };
33
-}
34
-
35 11
 /**
36 12
  * Create an action for when dominant speaker changes.
37 13
  *
@@ -93,6 +69,30 @@ export function localParticipantJoined(participant = {}) {
93 69
     });
94 70
 }
95 71
 
72
+/**
73
+ * Action to update a participant's connection status.
74
+ *
75
+ * @param {string} id - Participant's ID.
76
+ * @param {string} connectionStatus - The new connection status of the
77
+ * participant.
78
+ * @returns {{
79
+ *     type: PARTICIPANT_UPDATED,
80
+ *     participant: {
81
+ *         connectionStatus: string,
82
+ *         id: string
83
+ *     }
84
+ * }}
85
+ */
86
+export function participantConnectionStatusChanged(id, connectionStatus) {
87
+    return {
88
+        type: PARTICIPANT_UPDATED,
89
+        participant: {
90
+            connectionStatus,
91
+            id
92
+        }
93
+    };
94
+}
95
+
96 96
 /**
97 97
  * Action to remove a local participant.
98 98
  *

+ 18
- 10
react/features/base/participants/components/ParticipantView.native.js Voir le fichier

@@ -36,10 +36,11 @@ class ParticipantView extends Component {
36 36
         _avatar: React.PropTypes.string,
37 37
 
38 38
         /**
39
-         * The connection status for the participant. Its video will only be
40
-         * rendered if the connection status is 'active', otherwise the avatar
41
-         * will be rendered. If undefined, we have no indication, so the same
42
-         * course of action as 'active' is taken.
39
+         * The connection status of the participant. Her video will only be
40
+         * rendered if the connection status is 'active'; otherwise, the avatar
41
+         * will be rendered. If undefined, 'active' is presumed.
42
+         *
43
+         * @private
43 44
          */
44 45
         _connectionStatus: React.PropTypes.string,
45 46
 
@@ -106,10 +107,8 @@ class ParticipantView extends Component {
106 107
         // updated only after videoTrack is rendered.
107 108
         const waitForVideoStarted = false;
108 109
         const renderVideo
109
-            = shouldRenderVideoTrack(videoTrack, waitForVideoStarted)
110
-                && (typeof connectionStatus === 'undefined'
111
-                    || connectionStatus
112
-                        === JitsiParticipantConnectionStatus.ACTIVE);
110
+            = (connectionStatus === JitsiParticipantConnectionStatus.ACTIVE)
111
+                && shouldRenderVideoTrack(videoTrack, waitForVideoStarted);
113 112
 
114 113
         // Is the avatar to be rendered?
115 114
         const renderAvatar = Boolean(!renderVideo && avatar);
@@ -182,10 +181,19 @@ function _mapStateToProps(state, ownProps) {
182 181
         = getParticipantById(
183 182
             state['features/base/participants'],
184 183
             participantId);
184
+    let avatar;
185
+    let connectionStatus;
186
+
187
+    if (participant) {
188
+        avatar = getAvatarURL(participant);
189
+        connectionStatus = participant.connectionStatus;
190
+    }
185 191
 
186 192
     return {
187
-        _avatar: participant && getAvatarURL(participant),
188
-        _connectionStatus: participant && participant.connectionStatus,
193
+        _avatar: avatar,
194
+        _connectionStatus:
195
+            connectionStatus
196
+                || JitsiParticipantConnectionStatus.ACTIVE,
189 197
         _videoTrack:
190 198
             getTrackByMediaTypeAndParticipant(
191 199
                 state['features/base/tracks'],

+ 2
- 2
react/features/base/participants/reducer.js Voir le fichier

@@ -73,9 +73,9 @@ function _participant(state, action) {
73 73
         const participant = action.participant; // eslint-disable-line no-shadow
74 74
         const {
75 75
             avatarURL,
76
+            connectionStatus,
76 77
             dominantSpeaker,
77 78
             email,
78
-            connectionStatus,
79 79
             local,
80 80
             pinned,
81 81
             role
@@ -107,10 +107,10 @@ function _participant(state, action) {
107 107
         return {
108 108
             avatarID,
109 109
             avatarURL,
110
+            connectionStatus,
110 111
             dominantSpeaker: dominantSpeaker || false,
111 112
             email,
112 113
             id,
113
-            connectionStatus,
114 114
             local: local || false,
115 115
             name,
116 116
             pinned: pinned || false,

Chargement…
Annuler
Enregistrer