Fixes issue with not working hangup button on FF

This commit is contained in:
hristoterezov 2016-05-05 11:11:05 -05:00
parent 2c0d60a1f4
commit 9dc9dc3685
1 changed files with 38 additions and 19 deletions

View File

@ -122,18 +122,9 @@ function muteLocalVideo (muted) {
}
/**
* Disconnect from the conference and optionally request user feedback.
* @param {boolean} [requestFeedback=false] if user feedback should be requested
* Check if the welcome page is enabled and redirects to it.
*/
function hangup (requestFeedback = false) {
APP.conference._room.leave().then(() => {
connection.disconnect();
if (requestFeedback) {
return APP.UI.requestFeedback();
} else {
return Promise.resolve();
}
}).then(function () {
function maybeRedirectToWelcomePage() {
if (!config.enableWelcomePage) {
return;
}
@ -142,9 +133,37 @@ function hangup (requestFeedback = false) {
APP.settings.setWelcomePageEnabled(true);
window.location.pathname = "/";
}, 3000);
}, function (err) {
console.error('Failed to hangup the call:', err);
});
}
/**
* Executes connection.disconnect and shows the feedback dialog
* @param {boolean} [requestFeedback=false] if user feedback should be requested
* @returns Promise.
*/
function disconnectAndShowFeedback(requestFeedback) {
connection.disconnect();
if (requestFeedback) {
return APP.UI.requestFeedback();
} else {
return Promise.resolve();
}
}
/**
* Disconnect from the conference and optionally request user feedback.
* @param {boolean} [requestFeedback=false] if user feedback should be requested
*/
function hangup (requestFeedback = false) {
const errCallback = (f, err) => {
console.error('Error occurred during hanging up: ', err);
return f();
};
const disconnect = disconnectAndShowFeedback.bind(null, requestFeedback);
APP.conference._room.leave()
.then(disconnect)
.catch(errCallback.bind(null, disconnect))
.then(maybeRedirectToWelcomePage)
.catch(errCallback.bind(null, maybeRedirectToWelcomePage));
}
/**