|
|
@ -21,7 +21,15 @@ |
|
|
|
define([], function() { |
|
|
|
define([], function() { |
|
|
|
|
|
|
|
|
|
|
|
// ContactsmanagerController
|
|
|
|
// ContactsmanagerController
|
|
|
|
return ["$scope", "$modalInstance", "contactData", "data", "contacts", 'dialogs', 'translation', function($scope, $modalInstance, contactData, data, contacts, dialogs, translation) { |
|
|
|
return ["$scope", "$modalInstance", "contactData", "data", "contacts", "dialogs", "translation", "mediaStream", "buddyData", function($scope, $modalInstance, contactData, data, contacts, dialogs, translation, mediaStream, buddyData) { |
|
|
|
|
|
|
|
var getContactSessionId = function(userid) { |
|
|
|
|
|
|
|
var session = null; |
|
|
|
|
|
|
|
var scope = buddyData.lookup(userid, false, false); |
|
|
|
|
|
|
|
if (scope) { |
|
|
|
|
|
|
|
session = scope.session.get(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return session && session.Id ? session.Id : null; |
|
|
|
|
|
|
|
}; |
|
|
|
$scope.header = data.header; |
|
|
|
$scope.header = data.header; |
|
|
|
$scope.contacts = []; |
|
|
|
$scope.contacts = []; |
|
|
|
$scope.openContactsManagerEdit = function(contact) { |
|
|
|
$scope.openContactsManagerEdit = function(contact) { |
|
|
@ -36,7 +44,6 @@ define([], function() { |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var updateContacts = function() { |
|
|
|
var updateContacts = function() { |
|
|
|
$scope.contacts = contactData.getAll(); |
|
|
|
$scope.contacts = contactData.getAll(); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -50,7 +57,17 @@ define([], function() { |
|
|
|
contacts.e.on('contactremoved', function() { |
|
|
|
contacts.e.on('contactremoved', function() { |
|
|
|
updateContacts(); |
|
|
|
updateContacts(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
$scope.doCall = function(contact) { |
|
|
|
|
|
|
|
mediaStream.webrtc.doCall(getContactSessionId(contact.Userid)); |
|
|
|
|
|
|
|
$modalInstance.close(); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
$scope.startChat = function(contact) { |
|
|
|
|
|
|
|
$scope.$emit("startchat", getContactSessionId(contact.Userid), { |
|
|
|
|
|
|
|
autofocus: true, |
|
|
|
|
|
|
|
restore: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$modalInstance.close(); |
|
|
|
|
|
|
|
}; |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|