diff --git a/app.js b/app.js index 6e00cf81f..a7a2f61d7 100644 --- a/app.js +++ b/app.js @@ -76,22 +76,24 @@ const APP = { }; function init() { - APP.UI.start(); - APP.conference.init({roomName: buildRoomName()}).then(function () { - APP.UI.initConference(); + var isUIReady = APP.UI.start(); + if (isUIReady) { + APP.conference.init({roomName: buildRoomName()}).then(function () { + APP.UI.initConference(); - APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) { - APP.translation.setLanguage(language); - APP.settings.setLanguage(language); + APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) { + APP.translation.setLanguage(language); + APP.settings.setLanguage(language); + }); + + APP.desktopsharing.init(JitsiMeetJS.isDesktopSharingEnabled()); + APP.statistics.start(); + APP.connectionquality.init(); + APP.keyboardshortcut.init(); + }).catch(function (err) { + console.error(err); }); - - APP.desktopsharing.init(JitsiMeetJS.isDesktopSharingEnabled()); - APP.statistics.start(); - APP.connectionquality.init(); - APP.keyboardshortcut.init(); - }).catch(function (err) { - console.error(err); - }); + } } /** diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 731293bd3..a12fa709a 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -223,6 +223,12 @@ function bindEvents() { $(window).resize(onResize); } +/** + * Starts the UI module and initializes all related components. + * + * @returns {boolean} true if the UI is ready and the conference should be + * esablished, false - otherwise (for example in the case of welcome page) + */ UI.start = function () { document.title = interfaceConfig.APP_NAME; var setupWelcomePage = null; @@ -234,7 +240,9 @@ UI.start = function () { setupWelcomePage = require("./welcome_page/WelcomePage"); setupWelcomePage(); - return; + // Return false to indicate that the UI hasn't been fully started and + // conference ready. We're still waiting for input from the user. + return false; } $("#welcome_page").hide(); @@ -318,6 +326,9 @@ UI.start = function () { SettingsMenu.init(eventEmitter); } + // Return true to indicate that the UI has been fully started and + // conference ready. + return true; };