[RN] Load config.js only when the room is known

This patch loads the config later than we used to, that is, only once we
know the room the user is about to join.

Due to architectural limitations in lib-jitsi-meet, it needs to be
initialized with a configuration in order to properly function. This is
unfortunate because we need to create a video track in the welcome page,
but don't know the room (hence no config) yet. In order to circumvent
this problem an empty configuration is used, which is later swapped with
the appropriate one, once loaded.

Some interesting side-effects of this change are a perceived speed
increase when the app starts or a conference is hangup. They are both
due to the fact that no config needs to be fetched from a remote server
in those cases.
This commit is contained in:
Saúl Ibarra Corretgé 2017-08-25 14:51:57 +02:00 committed by Lyubo Marinov
parent 45a1ae26ca
commit 18d1572dab
2 changed files with 9 additions and 1 deletions

View File

@ -168,6 +168,14 @@ export function appWillUnmount(app) {
* @returns {Promise<Object>}
*/
function _loadConfig({ contextRoot, host, protocol, room }) {
// XXX As the mobile/React Native app does not employ config on the
// WelcomePage, do not download config.js from the deployment when
// navigating to the WelcomePage - the perceived/visible navigation will be
// faster.
if (!room && typeof APP === 'undefined') {
return Promise.resolve();
}
/* eslint-disable no-param-reassign */
protocol = protocol.toLowerCase();

View File

@ -14,7 +14,7 @@ import { SET_CONFIG } from './actionTypes';
* config: Object
* }}
*/
export function setConfig(config: Object) {
export function setConfig(config: Object = {}) {
return {
type: SET_CONFIG,
config