Browse Source

fix(remotecontrol): Replace info dialogs with notifications.

j8
hristoterezov 8 years ago
parent
commit
b8d3e82ae7

+ 2
- 2
css/_toastr.scss View File

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 View File

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

+ 33
- 4
modules/UI/util/MessageHandler.js View File

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 View File

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 View File

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 View File

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
                 );

Loading…
Cancel
Save