Files
jitsi-meet/react/features/conference/route.js
virtuacoplenny 510334fa7f ref(notifications): convert some dialogs to error or warning notifica… (#1991)
* ref(notifications): convert some dialogs to error or warning notifications

- Expand the configurability of the Notification component so warnings
  and errors can be displayed.
- Allow Notification to take in arbitrary text for the body.
- Rename defaultTitleKey to titleKey for consistency with descriptionKey.

* ref(notifications): remove openReportDialog method

openReportDialog is a wrapper around showError that adds
a logger statement. It is being called in one place only
so remove the method and have that one place call logger.

* ref(notifications): UI.showTrackNotWorkingDialog takes a boolean

Change UI.showTrackNotWorkingDialog so it takes a boolean
arguments instead of the entire track. A small refactor so
the method needs to know less.

* [squash] Fixes eslint errors

* WiP: Fixes desktop sharing error strings and adds support button

* [squash] Fix icons appearances

* [squash] Fix translate titles and messages

* [squash] fix(translation): Fixes incorrect password string

* [squash] fix(recording): Fixes recording message

* [squash] fix(warning): Turns some warnings to errors and makes support link optional.

* [squash] fix(translation): Addressing language comments

* [squash] Fixes jsdoc and formatting

* [squash] fix(noopener): Fixes window.open noopener

* [squash] fix(constants): Extract constants and refactor NotificationWithToggle

* [squash] fix(lang): Fixes camera and mic error titles

* [squash] fix(supportLink): Renames addSupportLink to hideErrorSupportLink
2017-11-03 14:05:03 -05:00

107 lines
2.9 KiB
JavaScript

// @flow
import ConferenceUrl from '../../../modules/URL/ConferenceUrl';
import { chooseBOSHAddress, obtainConfig } from '../base/config';
import { RouteRegistry } from '../base/react';
import { Conference } from './components';
declare var APP: Object;
declare var config: Object;
const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* Register route for Conference (page).
*/
RouteRegistry.register({
component: Conference,
onEnter: () => {
// XXX If config or jwt are set by hash or query parameters
// Getting raw URL before stripping it.
_obtainConfigAndInit();
},
path: '/:room'
});
/**
* Initialization of the app.
*
* @private
* @returns {void}
*/
function _initConference() {
APP.ConferenceUrl = new ConferenceUrl(window.location);
}
/**
* Promise wrapper on obtain config method. When HttpConfigFetch will be moved
* to React app it's better to use load config instead.
*
* @param {string} location - URL of the domain from which the config is to be
* obtained.
* @param {string} room - Room name.
* @private
* @returns {Promise}
*/
function _obtainConfig(location: string, room: string) {
return new Promise((resolve, reject) =>
obtainConfig(location, room, (success, error) => {
success ? resolve() : reject(error);
})
);
}
/**
* If we have an HTTP endpoint for getting config.json configured we're going to
* read it and override properties from config.js and interfaceConfig.js. If
* there is no endpoint we'll just continue with initialization. Keep in mind
* that if the endpoint has been configured and we fail to obtain the config for
* any reason then the conference won't start and error message will be
* displayed to the user.
*
* @private
* @returns {void}
*/
function _obtainConfigAndInit() {
// Skip initialization if conference is initialized already.
if (typeof APP !== 'undefined' && !APP.ConferenceUrl) {
const location = config.configLocation;
const room = APP.conference.roomName;
if (location) {
_obtainConfig(location, room)
.then(() => {
_obtainConfigHandler();
_initConference();
})
.catch(err => {
logger.log(err);
// Show obtain config error.
APP.UI.messageHandler.showError({
titleKey: 'connection.CONNFAIL',
descriptionKey: 'dialog.connectError'
});
});
} else {
chooseBOSHAddress(config, room);
_initConference();
}
}
}
/**
* Obtain config handler.
*
* @private
* @returns {Promise}
*/
function _obtainConfigHandler() {
const now = window.performance.now();
APP.connectionTimes['configuration.fetched'] = now;
logger.log('(TIME) configuration fetched:\t', now);
}