Browse Source

Comply w/ coding style

j8
Lyubo Marinov 8 years ago
parent
commit
0e9509ae9b

+ 15
- 9
react/features/base/conference/actions.js View File

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

+ 24
- 24
react/features/base/participants/actions.js View File

8
 } from './actionTypes';
8
 } from './actionTypes';
9
 import { getLocalParticipant } from './functions';
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
  * Create an action for when dominant speaker changes.
12
  * Create an action for when dominant speaker changes.
37
  *
13
  *
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
  * Action to remove a local participant.
97
  * Action to remove a local participant.
98
  *
98
  *

+ 18
- 10
react/features/base/participants/components/ParticipantView.native.js View File

36
         _avatar: React.PropTypes.string,
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
         _connectionStatus: React.PropTypes.string,
45
         _connectionStatus: React.PropTypes.string,
45
 
46
 
106
         // updated only after videoTrack is rendered.
107
         // updated only after videoTrack is rendered.
107
         const waitForVideoStarted = false;
108
         const waitForVideoStarted = false;
108
         const renderVideo
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
         // Is the avatar to be rendered?
113
         // Is the avatar to be rendered?
115
         const renderAvatar = Boolean(!renderVideo && avatar);
114
         const renderAvatar = Boolean(!renderVideo && avatar);
182
         = getParticipantById(
181
         = getParticipantById(
183
             state['features/base/participants'],
182
             state['features/base/participants'],
184
             participantId);
183
             participantId);
184
+    let avatar;
185
+    let connectionStatus;
186
+
187
+    if (participant) {
188
+        avatar = getAvatarURL(participant);
189
+        connectionStatus = participant.connectionStatus;
190
+    }
185
 
191
 
186
     return {
192
     return {
187
-        _avatar: participant && getAvatarURL(participant),
188
-        _connectionStatus: participant && participant.connectionStatus,
193
+        _avatar: avatar,
194
+        _connectionStatus:
195
+            connectionStatus
196
+                || JitsiParticipantConnectionStatus.ACTIVE,
189
         _videoTrack:
197
         _videoTrack:
190
             getTrackByMediaTypeAndParticipant(
198
             getTrackByMediaTypeAndParticipant(
191
                 state['features/base/tracks'],
199
                 state['features/base/tracks'],

+ 2
- 2
react/features/base/participants/reducer.js View File

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

Loading…
Cancel
Save