mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Created calls utilities
This commit is contained in:
parent
cbfe141c32
commit
1a3117a603
@ -1194,7 +1194,14 @@ var ComunicWeb = {
|
||||
*/
|
||||
ringScreen: {
|
||||
//TODO : implement
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls utilities
|
||||
*/
|
||||
utils: {
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -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){
|
||||
|
27
assets/js/components/calls/utils.js
Normal file
27
assets/js/components/calls/utils.js
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
};
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user