Created calls utilities

This commit is contained in:
Pierre HUBERT 2019-01-26 15:49:08 +01:00
parent cbfe141c32
commit 1a3117a603
4 changed files with 37 additions and 6 deletions

View File

@ -1194,7 +1194,14 @@ var ComunicWeb = {
*/
ringScreen: {
//TODO : implement
}
},
/**
* Calls utilities
*/
utils: {
//TODO : implement
},
},
/**

View File

@ -593,11 +593,7 @@ ComunicWeb.components.calls.callWindow = {
return;
//Check if all other members rejected call
var allDisconnected = true;
call.info.members.forEach(function(member){
if(member.status != "rejected" && member.status != "hang_up" && member.userID != userID())
allDisconnected = false;
});
var allDisconnected = ComunicWeb.components.calls.utils.hasEveryoneLeft(call.info);
//Check if all call peer rejected the call
if(allDisconnected){

View File

@ -0,0 +1,27 @@
/**
* Calls utilities
*
* @author Pierre HUBERT
*/
ComunicWeb.components.calls.utils = {
/**
* Check out whether all the members of a conversation stop to follow it,
* except the current user
*
* @param {Object} info Information about the conversation to analyze
*/
hasEveryoneLeft: function(info){
var allDisconnected = true;
info.members.forEach(function(member){
if(member.status != "rejected" && member.status != "hang_up" && member.userID != userID())
allDisconnected = false;
});
return allDisconnected;
}
};

View File

@ -453,6 +453,7 @@ class Dev {
"js/components/calls/currentList.js",
"js/components/calls/userMedia.js",
"js/components/calls/ringScreen.js",
"js/components/calls/utils.js",
//Pacman component (easter egg)
"js/components/pacman.js",