From fb082cf50ff1c48f651eb46fdf7398bacb85ad16 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 11 Sep 2014 15:23:06 +0100 Subject: 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. --- webclient/app-controller.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'webclient/app-controller.js') diff --git a/webclient/app-controller.js b/webclient/app-controller.js index 8383533cfb..945f71ed20 100644 --- a/webclient/app-controller.js +++ b/webclient/app-controller.js @@ -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); } } -- cgit 1.4.1