Handles data from feedback callback and use it for correct close page.
This commit is contained in:
parent
87f7be2182
commit
5feeef0122
|
@ -184,30 +184,34 @@ function muteLocalVideo (muted) {
|
||||||
* If requested show a thank you dialog before that.
|
* If requested show a thank you dialog before that.
|
||||||
* If we have a close page enabled, redirect to it without
|
* If we have a close page enabled, redirect to it without
|
||||||
* showing any other dialog.
|
* showing any other dialog.
|
||||||
* @param {boolean} showThankYou whether we should show a thank you dialog
|
*
|
||||||
|
* @param {object} data Feedback data
|
||||||
|
* @param {boolean} data.showThankYou - whether we should show thank you dialog
|
||||||
|
* @param {boolean} data.feedbackSubmitted - whether feedback was submitted
|
||||||
*/
|
*/
|
||||||
function maybeRedirectToWelcomePage(showThankYou) {
|
function maybeRedirectToWelcomePage(data) {
|
||||||
|
|
||||||
// if close page is enabled redirect to it, without further action
|
// if close page is enabled redirect to it, without further action
|
||||||
if (config.enableClosePage) {
|
if (config.enableClosePage) {
|
||||||
|
if (data.feedbackSubmitted)
|
||||||
window.location.pathname = "close.html";
|
window.location.pathname = "close.html";
|
||||||
|
else
|
||||||
|
window.location.pathname = "close2.html";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showThankYou) {
|
// else: show thankYou dialog only if there is no feedback
|
||||||
|
if (data.showThankYou)
|
||||||
APP.UI.messageHandler.openMessageDialog(
|
APP.UI.messageHandler.openMessageDialog(
|
||||||
null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME});
|
null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME});
|
||||||
}
|
|
||||||
|
|
||||||
if (!config.enableWelcomePage) {
|
// if Welcome page is enabled redirect to welcome page after 3 sec.
|
||||||
return;
|
if (config.enableWelcomePage) {
|
||||||
}
|
|
||||||
// redirect to welcome page
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
APP.settings.setWelcomePageEnabled(true);
|
APP.settings.setWelcomePageEnabled(true);
|
||||||
window.location.pathname = "/";
|
window.location.pathname = "/";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create local tracks of specified types.
|
* Create local tracks of specified types.
|
||||||
|
|
|
@ -1037,25 +1037,25 @@ UI.requestFeedbackOnHangup = function () {
|
||||||
if (Feedback.isVisible())
|
if (Feedback.isVisible())
|
||||||
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
|
return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
|
||||||
// Feedback has been submitted already.
|
// Feedback has been submitted already.
|
||||||
else if (Feedback.isEnabled() && Feedback.isSubmitted())
|
else if (Feedback.isEnabled() && Feedback.isSubmitted()) {
|
||||||
return Promise.resolve(true);
|
return Promise.resolve({
|
||||||
|
showThankYou : true,
|
||||||
|
feedbackSubmitted: true
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
if (Feedback.isEnabled()) {
|
if (Feedback.isEnabled()) {
|
||||||
// If the user has already entered feedback, we'll show the
|
Feedback.openFeedbackWindow(
|
||||||
// window and immidiately start the conference dispose timeout.
|
(data) => {
|
||||||
if (Feedback.getFeedbackScore() > 0) {
|
data.showThankYou = false;
|
||||||
Feedback.openFeedbackWindow();
|
resolve(data);
|
||||||
resolve(false);
|
});
|
||||||
|
|
||||||
} else { // Otherwise we'll wait for user's feedback.
|
|
||||||
Feedback.openFeedbackWindow(() => resolve(false));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// If the feedback functionality isn't enabled we show a thank
|
// If the feedback functionality isn't enabled we show a thank
|
||||||
// you dialog. Signaling it (true), so the caller
|
// you dialog. Signaling it (true), so the caller
|
||||||
// of requestFeedback can act on it
|
// of requestFeedback can act on it
|
||||||
resolve(true);
|
resolve({showThankYou : true, feedbackSubmitted: false});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue