Fixes hangup triggering several times

This commit is contained in:
yanas 2016-08-23 13:53:40 -05:00
parent b5c1c95a15
commit 2bb637e140
3 changed files with 50 additions and 21 deletions

View File

@ -37,6 +37,12 @@ let connectionIsInterrupted = false;
*/ */
let DSExternalInstallationInProgress = false; let DSExternalInstallationInProgress = false;
/**
* Indicates whether we have started a hangup process.
* @type {boolean}
*/
let _hangupInProgress = false;
import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo"; import {VIDEO_CONTAINER_TYPE} from "./modules/UI/videolayout/LargeVideo";
/** /**
@ -232,6 +238,13 @@ function disconnectAndShowFeedback(requestFeedback) {
* @param {boolean} [requestFeedback=false] if user feedback should be requested * @param {boolean} [requestFeedback=false] if user feedback should be requested
*/ */
function hangup (requestFeedback = false) { function hangup (requestFeedback = false) {
if (_hangupInProgress) {
console.log("Hangup already in progress.");
return;
}
_hangupInProgress = true;
const errCallback = (f, err) => { const errCallback = (f, err) => {
console.error('Error occurred during hanging up: ', err); console.error('Error occurred during hanging up: ', err);
return f(); return f();
@ -242,6 +255,8 @@ function hangup (requestFeedback = false) {
.catch(errCallback.bind(null, disconnect)) .catch(errCallback.bind(null, disconnect))
.then(maybeRedirectToWelcomePage) .then(maybeRedirectToWelcomePage)
.catch(errCallback.bind(null, maybeRedirectToWelcomePage)); .catch(errCallback.bind(null, maybeRedirectToWelcomePage));
_hangupInProgress = false;
} }
/** /**

View File

@ -134,6 +134,17 @@ var Feedback = {
isEnabled: function() { isEnabled: function() {
return this.enabled && APP.conference.isCallstatsEnabled(); return this.enabled && APP.conference.isCallstatsEnabled();
}, },
/**
* Returns true if the feedback window is currently visible and false
* otherwise.
* @return {boolean} true if the feedback window is visible, false
* otherwise
*/
isVisible: function() {
return $(".feedback").is(":visible");
},
/** /**
* Opens the feedback window. * Opens the feedback window.
*/ */

View File

@ -1063,10 +1063,13 @@ UI.inviteParticipants = function (roomUrl, conferenceName, key, nick) {
* @returns {Promise} when dialog is closed. * @returns {Promise} when dialog is closed.
*/ */
UI.requestFeedback = function () { UI.requestFeedback = function () {
if (Feedback.isVisible())
return Promise.resolve();
else
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
if (Feedback.isEnabled()) { if (Feedback.isEnabled()) {
// If the user has already entered feedback, we'll show the window and // If the user has already entered feedback, we'll show the
// immidiately start the conference dispose timeout. // window and immidiately start the conference dispose timeout.
if (Feedback.feedbackScore > 0) { if (Feedback.feedbackScore > 0) {
Feedback.openFeedbackWindow(); Feedback.openFeedbackWindow();
resolve(); resolve();
@ -1075,8 +1078,8 @@ UI.requestFeedback = function () {
Feedback.openFeedbackWindow(resolve); Feedback.openFeedbackWindow(resolve);
} }
} else { } else {
// If the feedback functionality isn't enabled we show a thank you // If the feedback functionality isn't enabled we show a thank
// dialog. // you dialog.
messageHandler.openMessageDialog( messageHandler.openMessageDialog(
null, null, null, null, null, null,
APP.translation.translateString( APP.translation.translateString(