mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Automatically retrieve calls configuration
This commit is contained in:
parent
e6f4159e53
commit
feb17e3f13
@ -1144,6 +1144,31 @@ var ComunicWeb = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls component
|
||||
*/
|
||||
calls: {
|
||||
|
||||
/**
|
||||
* Calls configuration
|
||||
*/
|
||||
__config: undefined,
|
||||
|
||||
/**
|
||||
* Calls interface
|
||||
*/
|
||||
interface: {
|
||||
//TODO : implement
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls controller
|
||||
*/
|
||||
controller: {
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Easter egg : pacman
|
||||
*/
|
||||
|
@ -58,6 +58,11 @@ ComunicWeb.common.system = {
|
||||
*/
|
||||
ComunicWeb.components.darkTheme.refresh();
|
||||
|
||||
/**
|
||||
* Initialize call system
|
||||
*/
|
||||
ComunicWeb.components.calls.controller.init();
|
||||
|
||||
/**
|
||||
* What to do after login refresh
|
||||
*/
|
||||
|
47
assets/js/components/calls/controller.js
Normal file
47
assets/js/components/calls/controller.js
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Calls controller
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.calls.controller = {
|
||||
|
||||
/**
|
||||
* This variable contains the initialization state
|
||||
* of the call component
|
||||
*/
|
||||
_is_init: false,
|
||||
|
||||
/**
|
||||
* Initialize calls component
|
||||
*/
|
||||
init: function(){
|
||||
|
||||
//We init this component just once
|
||||
if(this._is_init)
|
||||
return;
|
||||
|
||||
ComunicWeb.debug.logMessage("Initialize calls component");
|
||||
|
||||
//We wait the user to be connected before trying to get
|
||||
// call configuration
|
||||
document.addEventListener("got_user_id", function(){
|
||||
|
||||
//Check if we have already the call configuration
|
||||
if(ComunicWeb.components.calls.__config !== undefined)
|
||||
return;
|
||||
|
||||
ComunicWeb.components.calls.interface.getConfig(function(config){
|
||||
|
||||
//Check if we could not get calls configuration
|
||||
if(config.error)
|
||||
return;
|
||||
|
||||
//Save calls configuration
|
||||
ComunicWeb.components.calls.__config = config;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
19
assets/js/components/calls/interface.js
Normal file
19
assets/js/components/calls/interface.js
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Calls interface
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.calls.interface = {
|
||||
|
||||
/**
|
||||
* Get calls configuration
|
||||
*
|
||||
* @param {function} callback Function that will be called
|
||||
* once the operation has completed
|
||||
*/
|
||||
getConfig: function(callback){
|
||||
ComunicWeb.common.api.makeAPIrequest("calls/config", {}, true, callback);
|
||||
}
|
||||
|
||||
}
|
@ -77,12 +77,18 @@ ComunicWeb.user.userLogin = {
|
||||
//Perform next action
|
||||
afterGetCurrentUserID(0);
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
//Update user ID
|
||||
ComunicWeb.user.userLogin.__userID = result.userID;
|
||||
|
||||
//Perform next action
|
||||
afterGetCurrentUserID(result.userID)
|
||||
afterGetCurrentUserID(result.userID);
|
||||
|
||||
//Notify about the event
|
||||
SendEvent("got_user_id", {
|
||||
userID: result.userID
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -437,6 +437,10 @@ class Dev {
|
||||
"js/components/incognito/management.js",
|
||||
"js/components/incognito/keyboard.js",
|
||||
|
||||
//Calls compontent
|
||||
"js/components/calls/interface.js",
|
||||
"js/components/calls/controller.js",
|
||||
|
||||
//Pacman component (easter egg)
|
||||
"js/components/pacman.js",
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user