Make call stuff use modelService.

pull/11/head
Kegan Dougal 2014-11-03 10:33:38 +00:00
parent 395bb64b26
commit 53da1099d1
2 changed files with 5 additions and 5 deletions

View File

@ -21,8 +21,8 @@ limitations under the License.
'use strict'; 'use strict';
angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService']) angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'eventStreamService'])
.controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', '$timeout', '$animate', 'matrixService', 'mPresence', 'eventStreamService', 'eventHandlerService', 'matrixPhoneService', .controller('MatrixWebClientController', ['$scope', '$location', '$rootScope', '$timeout', '$animate', 'matrixService', 'mPresence', 'eventStreamService', 'eventHandlerService', 'matrixPhoneService', 'modelService',
function($scope, $location, $rootScope, $timeout, $animate, matrixService, mPresence, eventStreamService, eventHandlerService, matrixPhoneService) { function($scope, $location, $rootScope, $timeout, $animate, matrixService, mPresence, eventStreamService, eventHandlerService, matrixPhoneService, modelService) {
// Check current URL to avoid to display the logout button on the login page // Check current URL to avoid to display the logout button on the login page
$scope.location = $location.path(); $scope.location = $location.path();
@ -117,7 +117,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
return; return;
} }
var roomMembers = angular.copy($rootScope.events.rooms[$rootScope.currentCall.room_id].members); var roomMembers = angular.copy(modelService.getRoom($rootScope.currentCall.room_id).current_room_state.members);
delete roomMembers[matrixService.config().user_id]; delete roomMembers[matrixService.config().user_id];
$rootScope.currentCall.user_id = Object.keys(roomMembers)[0]; $rootScope.currentCall.user_id = Object.keys(roomMembers)[0];

View File

@ -46,7 +46,7 @@ var isWebRTCSupported = function () {
}; };
angular.module('MatrixCall', []) angular.module('MatrixCall', [])
.factory('MatrixCall', ['matrixService', 'matrixPhoneService', '$rootScope', '$timeout', function MatrixCallFactory(matrixService, matrixPhoneService, $rootScope, $timeout) { .factory('MatrixCall', ['matrixService', 'matrixPhoneService', 'modelService', '$rootScope', '$timeout', function MatrixCallFactory(matrixService, matrixPhoneService, modelService, $rootScope, $timeout) {
$rootScope.isWebRTCSupported = isWebRTCSupported(); $rootScope.isWebRTCSupported = isWebRTCSupported();
var MatrixCall = function(room_id) { var MatrixCall = function(room_id) {
@ -213,7 +213,7 @@ angular.module('MatrixCall', [])
var self = this; var self = this;
var roomMembers = $rootScope.events.rooms[this.room_id].members; var roomMembers = modelService.getRoom(this.room_id).current_room_state.members;
if (roomMembers[matrixService.config().user_id].membership != 'join') { if (roomMembers[matrixService.config().user_id].membership != 'join') {
console.log("We need to join the room before we can accept this call"); console.log("We need to join the room before we can accept this call");
matrixService.join(this.room_id).then(function() { matrixService.join(this.room_id).then(function() {