FS-7994 - Verto Communicator - Using factory for group calls in history

This commit is contained in:
Stefan Yohansson
2015-09-02 18:40:50 -03:00
committed by root
parent 46c0d05216
commit faed47bb49
8 changed files with 148 additions and 42 deletions

View File

@@ -4,15 +4,29 @@
angular
.module('vertoControllers')
.controller('DialPadController', ['$rootScope', '$scope',
'$http', '$location', 'toastr', 'verto', 'storage',
function($rootScope, $scope, $http, $location, toastr, verto, storage) {
'$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory',
function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory) {
console.debug('Executing DialPadController.');
$scope.checkBrowser();
$scope.call_history = CallHistory.all();
$scope.history_control = CallHistory.all_control();
$scope.has_history = Object.keys($scope.call_history).length;
storage.data.videoCall = false;
storage.data.userStatus = 'connecting';
storage.data.calling = false;
$scope.clearCallHistory = function() {
CallHistory.clear();
$scope.call_history = CallHistory.all();
$scope.history_control = CallHistory.all_control();
$scope.has_history = Object.keys($scope.call_history).length;
return $scope.history_control;
};
$scope.viewCallsList = function(calls) {
return $scope.call_list = calls;
};
/**
* fill dialpad via querystring [?autocall=\d+]
*/
@@ -62,14 +76,10 @@
verto.call($rootScope.dialpadNumber);
storage.data.called_number = $rootScope.dialpadNumber;
storage.data.call_history.unshift({
'number': $rootScope.dialpadNumber,
'direction': 'outbound',
'call_start': Date()
});
CallHistory.add($rootScope.dialpadNumber, 'outbound');
$location.path('/incall');
}
}
]);
})();
})();

View File

@@ -4,8 +4,8 @@
angular
.module('vertoControllers')
.controller('MainController',
function($scope, $rootScope, $location, $modal, $timeout, verto, storage, toastr, Fullscreen, prompt) {
function($scope, $rootScope, $location, $modal, $timeout, verto, storage, CallHistory, toastr, Fullscreen, prompt) {
console.debug('Executing MainController.');
var myVideo = document.getElementById("webcam");
@@ -140,7 +140,7 @@
);
};
$scope.openModal = function(templateUrl, controller) {
$rootScope.openModal = function(templateUrl, controller) {
var modalInstance = $modal.open({
animation: $scope.animationsEnabled,
templateUrl: templateUrl,
@@ -201,10 +201,6 @@
$scope.call_history = angular.element("#call_history").hasClass('active');
};
$scope.clearCallHistory = function() {
storage.data.call_history = [];
};
$scope.toggleChat = function() {
if ($scope.chatStatus && $rootScope.activePane === 'chat') {
$rootScope.chat_counter = 0;
@@ -328,22 +324,11 @@
$scope.answerCall();
storage.data.called_number = data;
storage.data.call_history.unshift({
'number': data,
'direction': 'inbound',
'status': true,
'call_start': Date()
});
CallHistory.add(number, 'inbound', true);
$location.path('/incall');
}, function() {
$scope.declineCall();
storage.data.call_history.unshift({
'number': data,
'direction': 'inbound',
'status': false,
'call_start': Date()
});
CallHistory.add(number, 'inbound', false);
});
});
@@ -439,4 +424,4 @@
}
);
})();
})();