Переглянути джерело

Platform generic notification for raised hand

master
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
         "moderator": "Moderator rights granted!",
469
         "moderator": "Moderator rights granted!",
470
         "muted": "You have started the conversation muted.",
470
         "muted": "You have started the conversation muted.",
471
         "mutedTitle": "You're muted!",
471
         "mutedTitle": "You're muted!",
472
-        "raisedHand": "Would like to speak.",
472
+        "raisedHand": "__name__ would like to speak.",
473
         "somebody": "Somebody",
473
         "somebody": "Somebody",
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>.",
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
         "suboptimalExperienceTitle": "Browser Warning"
475
         "suboptimalExperienceTitle": "Browser Warning"

+ 0
- 7
modules/UI/UI.js Переглянути файл

188
  */
188
  */
189
 UI.setRaisedHandStatus = (id, name, raisedHandStatus) => {
189
 UI.setRaisedHandStatus = (id, name, raisedHandStatus) => {
190
     VideoLayout.setRaisedHandStatus(id, raisedHandStatus);
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
 
2
 
3
 import UIEvents from '../../../../service/UI/UIEvents';
3
 import UIEvents from '../../../../service/UI/UIEvents';
4
 
4
 
5
+import { showNotification } from '../../notifications';
5
 import { CALLING, INVITED } from '../../presence-status';
6
 import { CALLING, INVITED } from '../../presence-status';
6
 
7
 
7
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
8
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
40
     getAvatarURLByParticipantId,
41
     getAvatarURLByParticipantId,
41
     getLocalParticipant,
42
     getLocalParticipant,
42
     getParticipantById,
43
     getParticipantById,
43
-    getParticipantCount
44
+    getParticipantCount,
45
+    getParticipantDisplayName
44
 } from './functions';
46
 } from './functions';
45
 import { PARTICIPANT_JOINED_FILE, PARTICIPANT_LEFT_FILE } from './sounds';
47
 import { PARTICIPANT_JOINED_FILE, PARTICIPANT_LEFT_FILE } from './sounds';
46
 
48
 
193
  */
195
  */
194
 StateListenerRegistry.register(
196
 StateListenerRegistry.register(
195
     state => state['features/base/conference'].conference,
197
     state => state['features/base/conference'].conference,
196
-    (conference, { dispatch }) => {
198
+    (conference, store) => {
197
         if (conference) {
199
         if (conference) {
198
             // We joined a conference
200
             // We joined a conference
199
             conference.on(
201
             conference.on(
207
                             features: { 'screen-sharing': true }
209
                             features: { 'screen-sharing': true }
208
                         }));
210
                         }));
209
                         break;
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
                         break;
215
                         break;
216
+                    }
217
                     default:
217
                     default:
218
 
218
 
219
                         // Ignore for now.
219
                         // Ignore for now.
371
     return next(action);
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
  * Registers sounds related with the participants feature.
403
  * Registers sounds related with the participants feature.
376
  *
404
  *

Завантаження…
Відмінити
Зберегти