浏览代码

fix(remotecontrol): Replace info dialogs with notifications.

master
hristoterezov 7 年前
父节点
当前提交
b8d3e82ae7

+ 2
- 2
css/_toastr.scss 查看文件

@@ -12,7 +12,7 @@
12 12
  */
13 13
 
14 14
 .toast-title,
15
-.toast-message .nickname {
15
+.toast-message .title {
16 16
   font-weight: bold;
17 17
   margin: 0 0 3px;
18 18
   @include text-truncate;
@@ -104,4 +104,4 @@
104 104
 #toast-container .toast {
105 105
   width: $notificationWidth;
106 106
   margin: 0 0 8px;
107
-}
107
+}

+ 11
- 11
modules/UI/UI.js 查看文件

@@ -193,8 +193,8 @@ UI.showLocalConnectionInterrupted = function (isInterrupted) {
193 193
 UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
194 194
     VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
195 195
     if (raisedHandStatus) {
196
-        messageHandler.notify(participant.getDisplayName(), 'notify.somebody',
197
-                          'connected', 'notify.raisedHand');
196
+        messageHandler.participantNotification(participant.getDisplayName(),
197
+            'notify.somebody', 'connected', 'notify.raisedHand');
198 198
     }
199 199
 };
200 200
 
@@ -489,7 +489,7 @@ UI.addUser = function (user) {
489 489
     if (UI.ContactList)
490 490
         UI.ContactList.addContact(id);
491 491
 
492
-    messageHandler.notify(
492
+    messageHandler.participantNotification(
493 493
         displayName,'notify.somebody', 'connected', 'notify.connected'
494 494
     );
495 495
 
@@ -517,7 +517,7 @@ UI.removeUser = function (id, displayName) {
517 517
     if (UI.ContactList)
518 518
         UI.ContactList.removeContact(id);
519 519
 
520
-    messageHandler.notify(
520
+    messageHandler.participantNotification(
521 521
         displayName,'notify.somebody', 'disconnected', 'notify.disconnected'
522 522
     );
523 523
 
@@ -553,8 +553,8 @@ UI.updateLocalRole = isModerator => {
553 553
 
554 554
     if (isModerator) {
555 555
         if (!interfaceConfig.DISABLE_FOCUS_INDICATOR)
556
-            messageHandler
557
-                .notify(null, "notify.me", 'connected', "notify.moderator");
556
+            messageHandler.participantNotification(
557
+                null, "notify.me", 'connected', "notify.moderator");
558 558
 
559 559
         Recording.checkAutoRecord();
560 560
     }
@@ -576,14 +576,14 @@ UI.updateUserRole = user => {
576 576
 
577 577
     var displayName = user.getDisplayName();
578 578
     if (displayName) {
579
-        messageHandler.notify(
579
+        messageHandler.participantNotification(
580 580
             displayName, 'notify.somebody',
581 581
             'connected', 'notify.grantedTo', {
582 582
                 to: UIUtil.escapeHtml(displayName)
583 583
             }
584 584
         );
585 585
     } else {
586
-        messageHandler.notify(
586
+        messageHandler.participantNotification(
587 587
             '', 'notify.somebody',
588 588
             'connected', 'notify.grantedToUnknown');
589 589
     }
@@ -597,7 +597,7 @@ UI.updateUserRole = user => {
597 597
  */
598 598
 UI.updateUserStatus = (user, status) => {
599 599
     let displayName = user.getDisplayName();
600
-    messageHandler.notify(
600
+    messageHandler.participantNotification(
601 601
         displayName, '', 'connected', "dialOut.statusMessage",
602 602
         {
603 603
             status: UIUtil.escapeHtml(status)
@@ -868,7 +868,7 @@ UI.notifyMaxUsersLimitReached = function () {
868 868
  * Notify user that he was automatically muted when joned the conference.
869 869
  */
870 870
 UI.notifyInitiallyMuted = function () {
871
-    messageHandler.notify(
871
+    messageHandler.participantNotification(
872 872
         null,
873 873
         "notify.mutedTitle",
874 874
         "connected",
@@ -1073,7 +1073,7 @@ UI.notifyInternalError = function () {
1073 1073
 };
1074 1074
 
1075 1075
 UI.notifyFocusDisconnected = function (focus, retrySec) {
1076
-    messageHandler.notify(
1076
+    messageHandler.participantNotification(
1077 1077
         null, "notify.focus",
1078 1078
         'disconnected', "notify.focusFail",
1079 1079
         {component: focus, ms: retrySec}

+ 33
- 4
modules/UI/util/MessageHandler.js 查看文件

@@ -439,7 +439,7 @@ var messageHandler = {
439 439
     },
440 440
 
441 441
     /**
442
-     * Displays a notification.
442
+     * Displays a notification about participant action.
443 443
      * @param displayName the display name of the participant that is
444 444
      * associated with the notification.
445 445
      * @param displayNameKey the key from the language file for the display
@@ -450,14 +450,14 @@ var messageHandler = {
450 450
      * @param messageArguments object with the arguments for the message.
451 451
      * @param options passed to toastr (e.g. timeOut)
452 452
      */
453
-    notify: function(displayName, displayNameKey, cls, messageKey,
454
-                     messageArguments, options) {
453
+    participantNotification: function(displayName, displayNameKey, cls,
454
+                    messageKey, messageArguments, options) {
455 455
 
456 456
         // If we're in ringing state we skip all toaster notifications.
457 457
         if(!notificationsEnabled || APP.UI.isOverlayVisible())
458 458
             return;
459 459
 
460
-        var displayNameSpan = '<span class="nickname" ';
460
+        var displayNameSpan = '<span class="title" ';
461 461
         if (displayName) {
462 462
             displayNameSpan += ">" + UIUtil.escapeHtml(displayName);
463 463
         } else {
@@ -475,6 +475,35 @@ var messageHandler = {
475 475
         return element;
476 476
     },
477 477
 
478
+    /**
479
+     * Displays a notification.
480
+     *
481
+     * @param {string} titleKey - The key from the language file for the title
482
+     * of the notification.
483
+     * @param {string} messageKey - The key from the language file for the text
484
+     * of the message.
485
+     * @param {Object} messageArguments - The arguments for the message
486
+     * translation.
487
+     * @returns {void}
488
+     */
489
+    notify: function(titleKey, messageKey, messageArguments) {
490
+
491
+        // If we're in ringing state we skip all toaster notifications.
492
+        if(!notificationsEnabled || APP.UI.isOverlayVisible())
493
+            return;
494
+
495
+        const options = messageArguments
496
+            ? `data-i18n-options='${JSON.stringify(messageArguments)}'` : "";
497
+        let element = toastr.info(`
498
+            <span class="title" data-i18n="${titleKey}"></span>
499
+            <br>
500
+            <span data-i18n="${messageKey}" ${options}></span>
501
+            `
502
+        );
503
+        APP.translation.translateElement(element);
504
+        return element;
505
+    },
506
+
478 507
     /**
479 508
      * Removes the toaster.
480 509
      * @param toasterElement

+ 2
- 2
modules/UI/videolayout/RemoteVideo.js 查看文件

@@ -248,7 +248,7 @@ RemoteVideo.prototype._requestRemoteControlPermissions = function () {
248 248
             return;
249 249
         }
250 250
         this.updateRemoteVideoMenu(this.isAudioMuted, true);
251
-        APP.UI.messageHandler.openMessageDialog(
251
+        APP.UI.messageHandler.notify(
252 252
             "dialog.remoteControlTitle",
253 253
             (result === false) ? "dialog.remoteControlDeniedMessage"
254 254
                 : "dialog.remoteControlAllowedMessage",
@@ -265,7 +265,7 @@ RemoteVideo.prototype._requestRemoteControlPermissions = function () {
265 265
     }, error => {
266 266
         logger.error(error);
267 267
         this.updateRemoteVideoMenu(this.isAudioMuted, true);
268
-        APP.UI.messageHandler.openMessageDialog(
268
+        APP.UI.messageHandler.notify(
269 269
             "dialog.remoteControlTitle",
270 270
             "dialog.remoteControlErrorMessage",
271 271
             {user: this.user.getDisplayName()

+ 1
- 1
modules/remotecontrol/Controller.js 查看文件

@@ -312,7 +312,7 @@ export default class Controller extends RemoteControlParticipant {
312 312
         this.pause();
313 313
         this._controlledParticipant = null;
314 314
         this._area = undefined;
315
-        APP.UI.messageHandler.openMessageDialog(
315
+        APP.UI.messageHandler.notify(
316 316
             'dialog.remoteControlTitle',
317 317
             'dialog.remoteControlStopMessage'
318 318
         );

+ 6
- 6
modules/remotecontrol/Receiver.js 查看文件

@@ -109,11 +109,11 @@ export default class Receiver extends RemoteControlParticipant {
109 109
      * displays dialog for informing the user that remote control session
110 110
      * ended.
111 111
      *
112
-     * @param {boolean} [dontShowDialog] - If true the dialog won't be
113
-     * displayed.
112
+     * @param {boolean} [dontNotify] - If true - a notification about stopping
113
+     * the remote control won't be displayed.
114 114
      * @returns {void}
115 115
      */
116
-    _stop(dontShowDialog: boolean = false) {
116
+    _stop(dontNotify: boolean = false) {
117 117
         if (!this._controller) {
118 118
             return;
119 119
         }
@@ -125,8 +125,8 @@ export default class Receiver extends RemoteControlParticipant {
125 125
             name: REMOTE_CONTROL_MESSAGE_NAME,
126 126
             type: EVENTS.stop
127 127
         });
128
-        if (!dontShowDialog) {
129
-            APP.UI.messageHandler.openMessageDialog(
128
+        if (!dontNotify) {
129
+            APP.UI.messageHandler.notify(
130 130
                 'dialog.remoteControlTitle',
131 131
                 'dialog.remoteControlStopMessage'
132 132
             );
@@ -241,7 +241,7 @@ export default class Receiver extends RemoteControlParticipant {
241 241
                     action: PERMISSIONS_ACTIONS.error
242 242
                 });
243 243
 
244
-                APP.UI.messageHandler.openMessageDialog(
244
+                APP.UI.messageHandler.notify(
245 245
                     'dialog.remoteControlTitle',
246 246
                     'dialog.startRemoteControlErrorMessage'
247 247
                 );

正在加载...
取消
保存