Updates openMessageDialog to get only key and options.

This commit is contained in:
damencho 2016-10-21 22:10:33 -05:00
parent efed4bf13c
commit 563ea1244c
3 changed files with 13 additions and 21 deletions

View File

@ -194,9 +194,8 @@ function maybeRedirectToWelcomePage(showThankYou) {
} }
if (showThankYou) { if (showThankYou) {
APP.UI.messageHandler.openMessageDialog(null, null, APP.UI.messageHandler.openMessageDialog(
APP.translation.generateTranslationHTML( null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME});
"dialog.thankYou", {appName:interfaceConfig.APP_NAME}));
} }
if (!config.enableWelcomePage) { if (!config.enableWelcomePage) {

View File

@ -1207,9 +1207,8 @@ UI.getLargeVideo = function () {
UI.showExtensionRequiredDialog = function (url) { UI.showExtensionRequiredDialog = function (url) {
messageHandler.openMessageDialog( messageHandler.openMessageDialog(
"dialog.extensionRequired", "dialog.extensionRequired",
null, "dialog.firefoxExtensionPrompt",
APP.translation.generateTranslationHTML( {url: url});
"dialog.firefoxExtensionPrompt", {url: url}));
}; };
/** /**
@ -1232,7 +1231,6 @@ UI.showExtensionExternalInstallationDialog = function (url) {
messageHandler.openTwoButtonDialog({ messageHandler.openTwoButtonDialog({
titleKey: 'dialog.externalInstallationTitle', titleKey: 'dialog.externalInstallationTitle',
msgKey: 'dialog.externalInstallationMsg', msgKey: 'dialog.externalInstallationMsg',
msgString: '',
leftButtonKey: 'dialog.goToStore', leftButtonKey: 'dialog.goToStore',
submitFunction, submitFunction,
loadedFunction: $.noop, loadedFunction: $.noop,
@ -1379,8 +1377,7 @@ UI.showTrackNotWorkingDialog = function (stream) {
messageHandler.openMessageDialog( messageHandler.openMessageDialog(
"dialog.error", "dialog.error",
stream.isAudioTrack()? "dialog.micNotSendingData" : stream.isAudioTrack()? "dialog.micNotSendingData" :
"dialog.cameraNotSendingData", "dialog.cameraNotSendingData");
null);
}; };
UI.updateDevicesAvailability = function (id, devices) { UI.updateDevicesAvailability = function (id, devices) {

View File

@ -29,23 +29,19 @@ var messageHandler = {
* *
* @param titleKey the key used to find the translation of the title of the * @param titleKey the key used to find the translation of the title of the
* message, if a message title is not provided. * message, if a message title is not provided.
* @param messageKey the key used to find the translation of the message, * @param messageKey the key used to find the translation of the message
* if a message is not provided. * @param i18nOptions the i18n options (optional)
* @param message the message to show. If a falsy value is provided,
* messageKey will be used to get a message via the translation API.
* @param closeFunction function to be called after * @param closeFunction function to be called after
* the prompt is closed (optional) * the prompt is closed (optional)
* @return the prompt that was created, or null * @return the prompt that was created, or null
*/ */
openMessageDialog: function(titleKey, messageKey, message, closeFunction) { openMessageDialog:
function(titleKey, messageKey, i18nOptions, closeFunction) {
if (!popupEnabled) if (!popupEnabled)
return null; return null;
if (!message) { let dialog = $.prompt(
message = APP.translation.generateTranslationHTML(messageKey); APP.translation.generateTranslationHTML(messageKey, i18nOptions), {
}
let dialog = $.prompt(message, {
title: this._getFormattedTitleString(titleKey), title: this._getFormattedTitleString(titleKey),
persistent: false, persistent: false,
promptspeed: 0, promptspeed: 0,
@ -55,7 +51,7 @@ var messageHandler = {
closeFunction(e, v, m, f); closeFunction(e, v, m, f);
} }
}); });
APP.translation.translateElement(dialog); APP.translation.translateElement(dialog, i18nOptions);
return dialog; return dialog;
}, },
/** /**