ソースを参照

Platform generic notification for raised hand

j8
Bettenbuk Zoltan 6年前
コミット
6ff733dae0
3個のファイルの変更37行の追加16行の削除
  1. 1
    1
      lang/main.json
  2. 0
    7
      modules/UI/UI.js
  3. 36
    8
      react/features/base/participants/middleware.js

+ 1
- 1
lang/main.json ファイルの表示

@@ -469,7 +469,7 @@
469 469
         "moderator": "Moderator rights granted!",
470 470
         "muted": "You have started the conversation muted.",
471 471
         "mutedTitle": "You're muted!",
472
-        "raisedHand": "Would like to speak.",
472
+        "raisedHand": "__name__ would like to speak.",
473 473
         "somebody": "Somebody",
474 474
         "suboptimalExperienceDescription": "Eer... we are afraid your experience with __appName__ isn't going to be that great here. We are looking for ways to improve this but, until then, please try using one of the <a href='static/recommendedBrowsers.html' target='_blank'>fully supported browsers</a>.",
475 475
         "suboptimalExperienceTitle": "Browser Warning"

+ 0
- 7
modules/UI/UI.js ファイルの表示

@@ -188,13 +188,6 @@ UI.changeDisplayName = function(id, displayName) {
188 188
  */
189 189
 UI.setRaisedHandStatus = (id, name, raisedHandStatus) => {
190 190
     VideoLayout.setRaisedHandStatus(id, raisedHandStatus);
191
-    if (raisedHandStatus) {
192
-        messageHandler.participantNotification(
193
-            name,
194
-            'notify.somebody',
195
-            'connected',
196
-            'notify.raisedHand');
197
-    }
198 191
 };
199 192
 
200 193
 /**

+ 36
- 8
react/features/base/participants/middleware.js ファイルの表示

@@ -2,6 +2,7 @@
2 2
 
3 3
 import UIEvents from '../../../../service/UI/UIEvents';
4 4
 
5
+import { showNotification } from '../../notifications';
5 6
 import { CALLING, INVITED } from '../../presence-status';
6 7
 
7 8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
@@ -40,7 +41,8 @@ import {
40 41
     getAvatarURLByParticipantId,
41 42
     getLocalParticipant,
42 43
     getParticipantById,
43
-    getParticipantCount
44
+    getParticipantCount,
45
+    getParticipantDisplayName
44 46
 } from './functions';
45 47
 import { PARTICIPANT_JOINED_FILE, PARTICIPANT_LEFT_FILE } from './sounds';
46 48
 
@@ -193,7 +195,7 @@ StateListenerRegistry.register(
193 195
  */
194 196
 StateListenerRegistry.register(
195 197
     state => state['features/base/conference'].conference,
196
-    (conference, { dispatch }) => {
198
+    (conference, store) => {
197 199
         if (conference) {
198 200
             // We joined a conference
199 201
             conference.on(
@@ -207,13 +209,11 @@ StateListenerRegistry.register(
207 209
                             features: { 'screen-sharing': true }
208 210
                         }));
209 211
                         break;
210
-                    case 'raisedHand':
211
-                        dispatch(participantUpdated({
212
-                            conference,
213
-                            id: participant.getId(),
214
-                            raisedHand: newValue === 'true'
215
-                        }));
212
+                    case 'raisedHand': {
213
+                        _raiseHandUpdated(
214
+                            store, conference, participant, newValue);
216 215
                         break;
216
+                    }
217 217
                     default:
218 218
 
219 219
                         // Ignore for now.
@@ -371,6 +371,34 @@ function _participantJoinedOrUpdated({ getState }, next, action) {
371 371
     return next(action);
372 372
 }
373 373
 
374
+/**
375
+ * Handles a raise hand status update.
376
+ *
377
+ * @param {Function} dispatch - The Redux dispatch function.
378
+ * @param {Object} conference - The conference for which we got an update.
379
+ * @param {*} participant - The participant from which we got an update.
380
+ * @param {*} newValue - The new value of the raise hand status.
381
+ * @returns {void}
382
+ */
383
+function _raiseHandUpdated({ dispatch, getState }, conference, participant, newValue) {
384
+    const raisedHand = newValue === 'true';
385
+
386
+    dispatch(participantUpdated({
387
+        conference,
388
+        id: participant.getId(),
389
+        raisedHand
390
+    }));
391
+
392
+    if (raisedHand) {
393
+        dispatch(showNotification({
394
+            titleArguments: {
395
+                name: getParticipantDisplayName(getState, participant.getId())
396
+            },
397
+            titleKey: 'notify.raisedHand'
398
+        }, 2500));
399
+    }
400
+}
401
+
374 402
 /**
375 403
  * Registers sounds related with the participants feature.
376 404
  *

読み込み中…
キャンセル
保存