diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-09-01 18:30:07 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-09-01 18:30:07 +0100 |
commit | 00b042a3eb1593a10f4dd149c0c45646178dc71a (patch) | |
tree | c7658c55c386ea2f106a6aa06ddf73c26776f9c1 /webclient/app-controller.js | |
parent | Enable SSL for s2s http client (diff) | |
parent | Follow API renaming. state -> presence. mtime_ago -> last_active_ago (diff) | |
download | synapse-00b042a3eb1593a10f4dd149c0c45646178dc71a.tar.xz |
Merge remote-tracking branch 'origin/develop' into server2server_tls
Diffstat (limited to 'webclient/app-controller.js')
-rw-r--r-- | webclient/app-controller.js | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js index 172770f82f..42c45f7c31 100644 --- a/webclient/app-controller.js +++ b/webclient/app-controller.js @@ -21,8 +21,8 @@ limitations under the License. 'use strict'; angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService']) -.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventStreamService', - function($scope, $location, $rootScope, matrixService, mPresence, eventStreamService) { +.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', 'matrixService', 'mPresence', 'eventStreamService', 'matrixPhoneService', + function($scope, $location, $rootScope, matrixService, mPresence, eventStreamService, matrixPhoneService) { // Check current URL to avoid to display the logout button on the login page $scope.location = $location.path(); @@ -36,8 +36,12 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even eventStreamService.resume(); mPresence.start(); } - - $scope.user_id = matrixService.config().user_id; + + $scope.user_id; + var config = matrixService.config(); + if (config) { + $scope.user_id = matrixService.config().user_id; + } /** * Open a given page. @@ -84,7 +88,27 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even $scope.updateHeader = function() { $scope.user_id = matrixService.config().user_id; }; + + $rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) { + console.trace("incoming call"); + call.onError = $scope.onCallError; + call.onHangup = $scope.onCallHangup; + $rootScope.currentCall = call; + }); + + $scope.answerCall = function() { + $scope.currentCall.answer(); + }; + + $scope.hangupCall = function() { + $scope.currentCall.hangup(); + $scope.currentCall = undefined; + }; -}]); + $rootScope.onCallError = function(errStr) { + $scope.feedback = errStr; + } - + $rootScope.onCallHangup = function() { + } +}]); |