FS-8205 [verto_communicator] fix incall redirect and first login (localstorage clear)

This commit is contained in:
Stefan Yohansson
2015-09-24 17:29:49 -03:00
committed by Ken Rice
parent 787671625d
commit 3d86aaacc5
8 changed files with 94 additions and 23 deletions

View File

@@ -4,9 +4,12 @@
angular
.module('vertoControllers')
.controller('DialPadController', ['$rootScope', '$scope',
'$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory',
function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory) {
'$http', '$location', 'toastr', 'verto', 'storage', 'CallHistory', 'eventQueue',
function($rootScope, $scope, $http, $location, toastr, verto, storage, CallHistory, eventQueue) {
console.debug('Executing DialPadController.');
eventQueue.process();
$scope.call_history = CallHistory.all();
$scope.history_control = CallHistory.all_control();
$scope.has_history = Object.keys($scope.call_history).length;

View File

@@ -11,7 +11,7 @@
}
}
preRoute();
verto.data.name = $scope.storage.data.name;
verto.data.email = $scope.storage.data.email;

View File

@@ -4,7 +4,7 @@
angular
.module('vertoControllers')
.controller('MainController',
function($scope, $rootScope, $location, $modal, $timeout, verto, storage, CallHistory, toastr, Fullscreen, prompt) {
function($scope, $rootScope, $location, $modal, $timeout, $q, verto, storage, CallHistory, toastr, Fullscreen, prompt, eventQueue) {
console.debug('Executing MainController.');
@@ -245,22 +245,27 @@
});
$rootScope.$on('page.incall', function(event, data) {
if (storage.data.askRecoverCall) {
prompt({
title: 'Oops, Active Call in Course.',
message: 'It seems you were in a call before leaving the last time. Wanna go back to that?'
}).then(function() {
console.log('redirect to incall page');
$location.path('/incall');
}, function() {
storage.data.userStatus = 'connecting';
verto.hangup();
var page_incall = function() {
return $q(function(resolve, reject) {
if (storage.data.askRecoverCall) {
prompt({
title: 'Oops, Active Call in Course.',
message: 'It seems you were in a call before leaving the last time. Wanna go back to that?'
}).then(function() {
console.log('redirect to incall page');
$location.path('/incall');
}, function() {
storage.data.userStatus = 'connecting';
verto.hangup();
});
} else {
console.log('redirect to incall page');
$location.path('/incall');
}
resolve();
});
} else {
console.log('redirect to incall page');
$location.path('/incall');
}
};
eventQueue.events.push(page_incall);
});
$scope.$on('event:google-plus-signin-success', function (event,authResult) {

View File

@@ -18,7 +18,7 @@
link = activity;
}
}
$location.path(link);
}
@@ -77,6 +77,7 @@
redirectTo('/dialpad');
} else {
redirectTo('/login');
$location.path('/login');
}
});