mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Can respond to calls
This commit is contained in:
@ -25,14 +25,19 @@ ComunicWeb.components.notifications.interface = {
|
||||
/**
|
||||
* Get the number of unread news such as notifications or conversations
|
||||
*
|
||||
* @param {boolean} get_calls Get the number of pending calls
|
||||
* @param {function} callback
|
||||
*/
|
||||
getAllUnread: function(callback){
|
||||
getAllUnread: function(get_calls, callback){
|
||||
|
||||
//Perform API request
|
||||
var apiURI = "notifications/count_all_news";
|
||||
var params = {};
|
||||
|
||||
//Check if we have to get the number of pending calls
|
||||
if(get_calls)
|
||||
params.include_calls = true;
|
||||
|
||||
//Perform the request
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
||||
|
||||
|
@ -35,7 +35,8 @@ ComunicWeb.components.notifications.service = {
|
||||
|
||||
|
||||
//Get the number of notifications from the API
|
||||
ComunicWeb.components.notifications.interface.getAllUnread(function(response){
|
||||
ComunicWeb.components.notifications.interface.getAllUnread(
|
||||
ComunicWeb.components.calls.controller.isAvailable(), function(response){
|
||||
|
||||
//Continue in case of success
|
||||
if(response.error)
|
||||
@ -76,6 +77,11 @@ ComunicWeb.components.notifications.service = {
|
||||
ComunicWeb.components.notifications.song.play();
|
||||
|
||||
ComunicWeb.components.notifications.service.last_notifs_number = total_number_notifs;
|
||||
|
||||
|
||||
//Process the number of calls if possible
|
||||
if(response.calls && response.calls > 0)
|
||||
ComunicWeb.components.calls.controller.newCallsAvailable(response.calls);
|
||||
});
|
||||
|
||||
}, 2000);
|
||||
|
Reference in New Issue
Block a user