From 210605d8f3a7c9897dc90cfd6f4d8d5fc32b847d Mon Sep 17 00:00:00 2001 From: paweldomas Date: Thu, 13 Oct 2016 11:14:56 -0500 Subject: [PATCH] fix(MessageHandler): suppress the notifications on top of the overlay --- modules/UI/UI.js | 11 +++++++---- .../UserMediaPermissionsGuidanceOverlay.js | 10 +++++++++- modules/UI/reload_overlay/PageReloadOverlay.js | 10 +++++++++- modules/UI/util/MessageHandler.js | 2 +- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/modules/UI/UI.js b/modules/UI/UI.js index ea289baef..144fef378 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -1450,12 +1450,15 @@ UI.hideRingOverLay = function () { }; /** - * Indicates if the ring overlay is currently visible. + * Indicates if any the "top" overlays are currently visible. The check includes + * the call overlay, GUM permissions overlay and a page reload overlay. * - * @returns {*|boolean} {true} if the ring overlay is visible, {false} otherwise + * @returns {*|boolean} {true} if the overlay is visible, {false} otherwise */ -UI.isRingOverlayVisible = function () { - return RingOverlay.isVisible(); +UI.isOverlayVisible = function () { + return RingOverlay.isVisible() + || PageReloadOverlay.isVisible() + || GumPermissionsOverlay.isVisible(); }; /** diff --git a/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js b/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js index 55b3bf902..d25880ba2 100644 --- a/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js +++ b/modules/UI/gum_overlay/UserMediaPermissionsGuidanceOverlay.js @@ -23,6 +23,14 @@ function buildOverlayHtml(browser) { } export default { + /** + * Checks whether the overlay is currently visible. + * @return {boolean} true if the overlay is visible + * or false otherwise. + */ + isVisible () { + return $overlay && $overlay.parents('body').length > 0; + }, /** * Shows browser-specific overlay with guidance how to proceed with * gUM prompt. @@ -32,7 +40,7 @@ export default { show(browser) { !$overlay && buildOverlayHtml(browser); - !$overlay.parents('body').length && $overlay.appendTo('body'); + !this.isVisible() && $overlay.appendTo('body'); }, /** diff --git a/modules/UI/reload_overlay/PageReloadOverlay.js b/modules/UI/reload_overlay/PageReloadOverlay.js index 21edbbd5e..15436597b 100644 --- a/modules/UI/reload_overlay/PageReloadOverlay.js +++ b/modules/UI/reload_overlay/PageReloadOverlay.js @@ -86,6 +86,14 @@ function start(timeoutSeconds) { } export default { + /** + * Checks whether the page reload overlay has been displayed. + * @return {boolean} true if the page reload overlay is currently + * visible or false otherwise. + */ + isVisible() { + return $overlay && $overlay.parents('body').length > 0; + }, /** * Shows the page reload overlay which will do the conference reload after * the given amount of time. @@ -97,7 +105,7 @@ export default { !$overlay && buildReloadOverlayHtml(); - if (!$overlay.parents('body').length) { + if (!this.isVisible()) { $overlay.appendTo('body'); start(timeoutSeconds); } diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js index 319a459e3..0a478a599 100644 --- a/modules/UI/util/MessageHandler.js +++ b/modules/UI/util/MessageHandler.js @@ -333,7 +333,7 @@ var messageHandler = { messageArguments, options) { // If we're in ringing state we skip all toaster notifications. - if(!notificationsEnabled || APP.UI.isRingOverlayVisible()) + if(!notificationsEnabled || APP.UI.isOverlayVisible()) return; var displayNameSpan = '