mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 19:15:04 -04:00
start towards glare support (currently not much better but no worse than before) including fixing a lot of self/var self/this fails that caused chaos when we started to have more than one call in play.
This commit is contained in:
parent
806c49a690
commit
fb082cf50f
3 changed files with 116 additions and 60 deletions
|
@ -135,9 +135,9 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
|||
});
|
||||
|
||||
$rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) {
|
||||
console.trace("incoming call");
|
||||
console.log("incoming call");
|
||||
if ($rootScope.currentCall && $rootScope.currentCall.state != 'ended') {
|
||||
console.trace("rejecting call because we're already in a call");
|
||||
console.log("rejecting call because we're already in a call");
|
||||
call.hangup();
|
||||
return;
|
||||
}
|
||||
|
@ -146,6 +146,13 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
|||
$rootScope.currentCall = call;
|
||||
});
|
||||
|
||||
$rootScope.$on(matrixPhoneService.REPLACED_CALL_EVENT, function(ngEvent, oldCall, newCall) {
|
||||
console.log("call ID "+oldCall+" has been replaced by call ID "+newCall+"!");
|
||||
newCall.onError = $scope.onCallError;
|
||||
newCall.onHangup = $scope.onCallHangup;
|
||||
$rootScope.currentCall = newCall;
|
||||
});
|
||||
|
||||
$scope.answerCall = function() {
|
||||
$rootScope.currentCall.answer();
|
||||
};
|
||||
|
@ -161,7 +168,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
|
|||
$rootScope.onCallHangup = function(call) {
|
||||
if (call == $rootScope.currentCall) {
|
||||
$timeout(function(){
|
||||
$rootScope.currentCall = undefined;
|
||||
if (call == $rootScope.currentCall) $rootScope.currentCall = undefined;
|
||||
}, 4070);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue