mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Close ring screen if user respond to call on another client
This commit is contained in:
parent
c819aaf716
commit
be0306b309
@ -213,7 +213,12 @@ ComunicWeb.components.calls.controller = {
|
|||||||
|
|
||||||
//Refuse the call if everyone has left it
|
//Refuse the call if everyone has left it
|
||||||
if(ComunicWeb.components.calls.utils.hasEveryoneLeft(info))
|
if(ComunicWeb.components.calls.utils.hasEveryoneLeft(info))
|
||||||
ringScreenInfo.respond(false);
|
ringScreenInfo.respond(false);
|
||||||
|
|
||||||
|
//Close ring screen if user responded to the call on another Comunic client
|
||||||
|
if(ComunicWeb.components.calls.utils.getCurrentUserState(info) != "unknown")
|
||||||
|
ringScreenInfo.close();
|
||||||
|
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
|
@ -71,20 +71,26 @@ ComunicWeb.components.calls.ringScreen = {
|
|||||||
innerHTML: "Accept"
|
innerHTML: "Accept"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var close = function(){
|
||||||
|
|
||||||
|
ComunicWeb.components.calls.ringScreen._song.stop();
|
||||||
|
|
||||||
|
//Remove elem
|
||||||
|
emptyElem(callContainer);
|
||||||
|
callContainer.remove();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var hasResponded = false;
|
var hasResponded = false;
|
||||||
var respond = function(accept){
|
var respond = function(accept){
|
||||||
|
|
||||||
ComunicWeb.components.calls.ringScreen._song.stop();
|
close();
|
||||||
|
|
||||||
if(hasResponded)
|
if(hasResponded)
|
||||||
return;
|
return;
|
||||||
hasResponded = true;
|
hasResponded = true;
|
||||||
|
|
||||||
callback(accept);
|
callback(accept);
|
||||||
|
|
||||||
//Remove elem
|
|
||||||
emptyElem(callContainer);
|
|
||||||
callContainer.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rejectButton.addEventListener("click", function() {
|
rejectButton.addEventListener("click", function() {
|
||||||
@ -102,6 +108,12 @@ ComunicWeb.components.calls.ringScreen = {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function to close the current ringscreen, without
|
||||||
|
* calling callback
|
||||||
|
*/
|
||||||
|
close: close,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function to programmatically respond to call
|
* A function to programmatically respond to call
|
||||||
*/
|
*/
|
||||||
|
@ -22,6 +22,23 @@ ComunicWeb.components.calls.utils = {
|
|||||||
|
|
||||||
return allDisconnected;
|
return allDisconnected;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current user response to a call
|
||||||
|
*
|
||||||
|
* @param {Call} call Current call information
|
||||||
|
* @return The response of the current user to the call
|
||||||
|
*/
|
||||||
|
getCurrentUserState: function(call){
|
||||||
|
|
||||||
|
var userstate = undefined;
|
||||||
|
call.members.forEach(function(member){
|
||||||
|
if(member.userID == userID())
|
||||||
|
userstate = member.status
|
||||||
|
});
|
||||||
|
|
||||||
|
return userstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user