ref(ConferenceUrl): converts to class and binds instance to global APP
Converts ConferenceUrl to a class and binds an instance to the global APP variable, as requested by HTerezov.
This commit is contained in:
parent
d342f93547
commit
8f8b1385fa
12
app.js
12
app.js
|
@ -19,12 +19,12 @@ import 'aui-experimental-css';
|
||||||
window.toastr = require("toastr");
|
window.toastr = require("toastr");
|
||||||
|
|
||||||
import URLProcessor from "./modules/config/URLProcessor";
|
import URLProcessor from "./modules/config/URLProcessor";
|
||||||
import ConferenceUrl from './modules/URL/ConferenceUrl';
|
|
||||||
import RoomnameGenerator from './modules/util/RoomnameGenerator';
|
import RoomnameGenerator from './modules/util/RoomnameGenerator';
|
||||||
|
|
||||||
import UI from "./modules/UI/UI";
|
import UI from "./modules/UI/UI";
|
||||||
import settings from "./modules/settings/Settings";
|
import settings from "./modules/settings/Settings";
|
||||||
import conference from './conference';
|
import conference from './conference';
|
||||||
|
import ConferenceUrl from './modules/URL/ConferenceUrl';
|
||||||
import API from './modules/API/API';
|
import API from './modules/API/API';
|
||||||
|
|
||||||
import UIEvents from './service/UI/UIEvents';
|
import UIEvents from './service/UI/UIEvents';
|
||||||
|
@ -95,6 +95,12 @@ const APP = {
|
||||||
UI,
|
UI,
|
||||||
settings,
|
settings,
|
||||||
conference,
|
conference,
|
||||||
|
/**
|
||||||
|
* After the APP has been initialized provides utility methods for dealing
|
||||||
|
* with the conference room URL(address).
|
||||||
|
* @type ConferenceUrl
|
||||||
|
*/
|
||||||
|
ConferenceUrl : null,
|
||||||
connection: null,
|
connection: null,
|
||||||
API,
|
API,
|
||||||
init () {
|
init () {
|
||||||
|
@ -121,9 +127,9 @@ function setTokenData() {
|
||||||
function init() {
|
function init() {
|
||||||
setTokenData();
|
setTokenData();
|
||||||
// Initialize the conference URL handler
|
// Initialize the conference URL handler
|
||||||
ConferenceUrl.init(window.location);
|
APP.ConferenceUrl = new ConferenceUrl(window.location);
|
||||||
// Clean up the URL displayed by the browser
|
// Clean up the URL displayed by the browser
|
||||||
replaceHistoryState(ConferenceUrl.getInviteUrl());
|
replaceHistoryState(APP.ConferenceUrl.getInviteUrl());
|
||||||
var isUIReady = APP.UI.start();
|
var isUIReady = APP.UI.start();
|
||||||
if (isUIReady) {
|
if (isUIReady) {
|
||||||
APP.conference.init({roomName: buildRoomName()}).then(function () {
|
APP.conference.init({roomName: buildRoomName()}).then(function () {
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
import InviteDialogView from './InviteDialogView';
|
import InviteDialogView from './InviteDialogView';
|
||||||
import createRoomLocker from './RoomLocker';
|
import createRoomLocker from './RoomLocker';
|
||||||
import UIEvents from '../../../service/UI/UIEvents';
|
import UIEvents from '../../../service/UI/UIEvents';
|
||||||
import ConferenceUrl from '../../URL/ConferenceUrl';
|
|
||||||
|
|
||||||
const ConferenceEvents = JitsiMeetJS.events.conference;
|
const ConferenceEvents = JitsiMeetJS.events.conference;
|
||||||
|
|
||||||
|
@ -15,7 +14,7 @@ const ConferenceEvents = JitsiMeetJS.events.conference;
|
||||||
class Invite {
|
class Invite {
|
||||||
constructor(conference) {
|
constructor(conference) {
|
||||||
this.conference = conference;
|
this.conference = conference;
|
||||||
this.inviteUrl = ConferenceUrl.getInviteUrl();
|
this.inviteUrl = APP.ConferenceUrl.getInviteUrl();
|
||||||
this.createRoomLocker(conference);
|
this.createRoomLocker(conference);
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/* global $, APP, AJS */
|
/* global $, APP, AJS */
|
||||||
|
|
||||||
import ConferenceUrl from '../../URL/ConferenceUrl';
|
|
||||||
|
|
||||||
let $overlay;
|
let $overlay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +77,7 @@ function start(timeoutSeconds) {
|
||||||
|
|
||||||
if (timeLeft === 0) {
|
if (timeLeft === 0) {
|
||||||
window.clearInterval(intervalId);
|
window.clearInterval(intervalId);
|
||||||
ConferenceUrl.reload();
|
APP.ConferenceUrl.reload();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
|
/* global console */
|
||||||
|
|
||||||
import { redirect } from '../util/helpers';
|
import { redirect } from '../util/helpers';
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores the original conference room URL with all parameters.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
let originalURL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simplified version of the conference URL stripped out of the parameters
|
|
||||||
* which should be used for sending invites.
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
let inviteURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The modules stores information about the URL used to start the conference and
|
* The modules stores information about the URL used to start the conference and
|
||||||
* provides utility methods for dealing with conference URL and reloads.
|
* provides utility methods for dealing with conference URL and reloads.
|
||||||
*/
|
*/
|
||||||
export default {
|
export default class ConferenceUrl {
|
||||||
/**
|
/**
|
||||||
* Initializes the module.
|
* Initializes the module.
|
||||||
*
|
*
|
||||||
|
@ -40,34 +28,46 @@ export default {
|
||||||
* @param location.protocol the protocol part of the URL, would be 'https:'
|
* @param location.protocol the protocol part of the URL, would be 'https:'
|
||||||
* from the sample URL.
|
* from the sample URL.
|
||||||
*/
|
*/
|
||||||
init(location) {
|
constructor(location) {
|
||||||
originalURL = location.href;
|
/**
|
||||||
// "https:" + "//" + "example.com:8888" + "/SomeConference1245"
|
* Stores the original conference room URL with all parameters.
|
||||||
inviteURL
|
* Example:
|
||||||
|
* https://example.com:8888/SomeConference1245?jwt=a5sbc2#blablahash
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.originalURL = location.href;
|
||||||
|
/**
|
||||||
|
* A simplified version of the conference URL stripped out of
|
||||||
|
* the parameters which should be used for sending invites.
|
||||||
|
* Example:
|
||||||
|
* https://example.com:8888/SomeConference1245
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.inviteURL
|
||||||
= location.protocol + "//" + location.host + location.pathname;
|
= location.protocol + "//" + location.host + location.pathname;
|
||||||
console.info("Stored original conference URL: " + originalURL);
|
console.info("Stored original conference URL: " + this.originalURL);
|
||||||
console.info("Conference URL for invites: " + inviteURL);
|
console.info("Conference URL for invites: " + this.inviteURL);
|
||||||
},
|
}
|
||||||
/**
|
/**
|
||||||
* Obtains the conference invite URL.
|
* Obtains the conference invite URL.
|
||||||
* @return {string} the URL pointing o the conference which is mean to be
|
* @return {string} the URL pointing o the conference which is mean to be
|
||||||
* used to invite new participants.
|
* used to invite new participants.
|
||||||
*/
|
*/
|
||||||
getInviteUrl() {
|
getInviteUrl() {
|
||||||
return inviteURL;
|
return this.inviteURL;
|
||||||
},
|
}
|
||||||
/**
|
/**
|
||||||
* Obtains full conference URL with all original parameters.
|
* Obtains full conference URL with all original parameters.
|
||||||
* @return {string} the original URL used to open the current conference.
|
* @return {string} the original URL used to open the current conference.
|
||||||
*/
|
*/
|
||||||
getOriginalUrl() {
|
getOriginalUrl() {
|
||||||
return originalURL;
|
return this.originalURL;
|
||||||
},
|
}
|
||||||
/**
|
/**
|
||||||
* Reloads the conference using original URL with all of the parameters.
|
* Reloads the conference using original URL with all of the parameters.
|
||||||
*/
|
*/
|
||||||
reload() {
|
reload() {
|
||||||
console.info("Reloading the conference using URL: " + originalURL);
|
console.info("Reloading the conference using URL: " + this.originalURL);
|
||||||
redirect(originalURL);
|
redirect(this.originalURL);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
Loading…
Reference in New Issue