浏览代码

Merge pull request #1757 from jitsi/rc_dialog_to_notification

fix(remotecontrol): Replace info dialogs with notifications.
master
virtuacoplenny 8 年前
父节点
当前提交
37328b3995

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

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

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

192
 UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
192
 UI.setRaisedHandStatus = (participant, raisedHandStatus) => {
193
     VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
193
     VideoLayout.setRaisedHandStatus(participant.getId(), raisedHandStatus);
194
     if (raisedHandStatus) {
194
     if (raisedHandStatus) {
195
-        messageHandler.notify(participant.getDisplayName(), 'notify.somebody',
196
-                          'connected', 'notify.raisedHand');
195
+        messageHandler.participantNotification(participant.getDisplayName(),
196
+            'notify.somebody', 'connected', 'notify.raisedHand');
197
     }
197
     }
198
 };
198
 };
199
 
199
 
488
     if (UI.ContactList)
488
     if (UI.ContactList)
489
         UI.ContactList.addContact(id);
489
         UI.ContactList.addContact(id);
490
 
490
 
491
-    messageHandler.notify(
491
+    messageHandler.participantNotification(
492
         displayName,'notify.somebody', 'connected', 'notify.connected'
492
         displayName,'notify.somebody', 'connected', 'notify.connected'
493
     );
493
     );
494
 
494
 
516
     if (UI.ContactList)
516
     if (UI.ContactList)
517
         UI.ContactList.removeContact(id);
517
         UI.ContactList.removeContact(id);
518
 
518
 
519
-    messageHandler.notify(
519
+    messageHandler.participantNotification(
520
         displayName,'notify.somebody', 'disconnected', 'notify.disconnected'
520
         displayName,'notify.somebody', 'disconnected', 'notify.disconnected'
521
     );
521
     );
522
 
522
 
552
 
552
 
553
     if (isModerator) {
553
     if (isModerator) {
554
         if (!interfaceConfig.DISABLE_FOCUS_INDICATOR)
554
         if (!interfaceConfig.DISABLE_FOCUS_INDICATOR)
555
-            messageHandler
556
-                .notify(null, "notify.me", 'connected', "notify.moderator");
555
+            messageHandler.participantNotification(
556
+                null, "notify.me", 'connected', "notify.moderator");
557
 
557
 
558
         Recording.checkAutoRecord();
558
         Recording.checkAutoRecord();
559
     }
559
     }
575
 
575
 
576
     var displayName = user.getDisplayName();
576
     var displayName = user.getDisplayName();
577
     if (displayName) {
577
     if (displayName) {
578
-        messageHandler.notify(
578
+        messageHandler.participantNotification(
579
             displayName, 'notify.somebody',
579
             displayName, 'notify.somebody',
580
             'connected', 'notify.grantedTo', {
580
             'connected', 'notify.grantedTo', {
581
                 to: UIUtil.escapeHtml(displayName)
581
                 to: UIUtil.escapeHtml(displayName)
582
             }
582
             }
583
         );
583
         );
584
     } else {
584
     } else {
585
-        messageHandler.notify(
585
+        messageHandler.participantNotification(
586
             '', 'notify.somebody',
586
             '', 'notify.somebody',
587
             'connected', 'notify.grantedToUnknown');
587
             'connected', 'notify.grantedToUnknown');
588
     }
588
     }
596
  */
596
  */
597
 UI.updateUserStatus = (user, status) => {
597
 UI.updateUserStatus = (user, status) => {
598
     let displayName = user.getDisplayName();
598
     let displayName = user.getDisplayName();
599
-    messageHandler.notify(
599
+    messageHandler.participantNotification(
600
         displayName, '', 'connected', "dialOut.statusMessage",
600
         displayName, '', 'connected', "dialOut.statusMessage",
601
         {
601
         {
602
             status: UIUtil.escapeHtml(status)
602
             status: UIUtil.escapeHtml(status)
864
  * Notify user that he was automatically muted when joned the conference.
864
  * Notify user that he was automatically muted when joned the conference.
865
  */
865
  */
866
 UI.notifyInitiallyMuted = function () {
866
 UI.notifyInitiallyMuted = function () {
867
-    messageHandler.notify(
867
+    messageHandler.participantNotification(
868
         null,
868
         null,
869
         "notify.mutedTitle",
869
         "notify.mutedTitle",
870
         "connected",
870
         "connected",
1069
 };
1069
 };
1070
 
1070
 
1071
 UI.notifyFocusDisconnected = function (focus, retrySec) {
1071
 UI.notifyFocusDisconnected = function (focus, retrySec) {
1072
-    messageHandler.notify(
1072
+    messageHandler.participantNotification(
1073
         null, "notify.focus",
1073
         null, "notify.focus",
1074
         'disconnected', "notify.focusFail",
1074
         'disconnected', "notify.focusFail",
1075
         {component: focus, ms: retrySec}
1075
         {component: focus, ms: retrySec}

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

439
     },
439
     },
440
 
440
 
441
     /**
441
     /**
442
-     * Displays a notification.
442
+     * Displays a notification about participant action.
443
      * @param displayName the display name of the participant that is
443
      * @param displayName the display name of the participant that is
444
      * associated with the notification.
444
      * associated with the notification.
445
      * @param displayNameKey the key from the language file for the display
445
      * @param displayNameKey the key from the language file for the display
450
      * @param messageArguments object with the arguments for the message.
450
      * @param messageArguments object with the arguments for the message.
451
      * @param options passed to toastr (e.g. timeOut)
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
         // If we're in ringing state we skip all toaster notifications.
456
         // If we're in ringing state we skip all toaster notifications.
457
         if(!notificationsEnabled || APP.UI.isOverlayVisible())
457
         if(!notificationsEnabled || APP.UI.isOverlayVisible())
458
             return;
458
             return;
459
 
459
 
460
-        var displayNameSpan = '<span class="nickname" ';
460
+        var displayNameSpan = '<span class="title" ';
461
         if (displayName) {
461
         if (displayName) {
462
             displayNameSpan += ">" + UIUtil.escapeHtml(displayName);
462
             displayNameSpan += ">" + UIUtil.escapeHtml(displayName);
463
         } else {
463
         } else {
475
         return element;
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
      * Removes the toaster.
508
      * Removes the toaster.
480
      * @param toasterElement
509
      * @param toasterElement

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

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

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

312
         this.pause();
312
         this.pause();
313
         this._controlledParticipant = null;
313
         this._controlledParticipant = null;
314
         this._area = undefined;
314
         this._area = undefined;
315
-        APP.UI.messageHandler.openMessageDialog(
315
+        APP.UI.messageHandler.notify(
316
             'dialog.remoteControlTitle',
316
             'dialog.remoteControlTitle',
317
             'dialog.remoteControlStopMessage'
317
             'dialog.remoteControlStopMessage'
318
         );
318
         );

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

109
      * displays dialog for informing the user that remote control session
109
      * displays dialog for informing the user that remote control session
110
      * ended.
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
      * @returns {void}
114
      * @returns {void}
115
      */
115
      */
116
-    _stop(dontShowDialog: boolean = false) {
116
+    _stop(dontNotify: boolean = false) {
117
         if (!this._controller) {
117
         if (!this._controller) {
118
             return;
118
             return;
119
         }
119
         }
125
             name: REMOTE_CONTROL_MESSAGE_NAME,
125
             name: REMOTE_CONTROL_MESSAGE_NAME,
126
             type: EVENTS.stop
126
             type: EVENTS.stop
127
         });
127
         });
128
-        if (!dontShowDialog) {
129
-            APP.UI.messageHandler.openMessageDialog(
128
+        if (!dontNotify) {
129
+            APP.UI.messageHandler.notify(
130
                 'dialog.remoteControlTitle',
130
                 'dialog.remoteControlTitle',
131
                 'dialog.remoteControlStopMessage'
131
                 'dialog.remoteControlStopMessage'
132
             );
132
             );
241
                     action: PERMISSIONS_ACTIONS.error
241
                     action: PERMISSIONS_ACTIONS.error
242
                 });
242
                 });
243
 
243
 
244
-                APP.UI.messageHandler.openMessageDialog(
244
+                APP.UI.messageHandler.notify(
245
                     'dialog.remoteControlTitle',
245
                     'dialog.remoteControlTitle',
246
                     'dialog.startRemoteControlErrorMessage'
246
                     'dialog.startRemoteControlErrorMessage'
247
                 );
247
                 );

正在加载...
取消
保存