diff --git a/html5/verto/verto_communicator/src/index.html b/html5/verto/verto_communicator/src/index.html
index 79c6a9cc8b..ba8b790c2e 100644
--- a/html5/verto/verto_communicator/src/index.html
+++ b/html5/verto/verto_communicator/src/index.html
@@ -120,6 +120,7 @@
+
diff --git a/html5/verto/verto_communicator/src/partials/menu.html b/html5/verto/verto_communicator/src/partials/menu.html
index ea846ddc1e..f0adc3f24d 100644
--- a/html5/verto/verto_communicator/src/partials/menu.html
+++ b/html5/verto/verto_communicator/src/partials/menu.html
@@ -13,7 +13,7 @@
-
+
Verto Communicator
diff --git a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js
index 351dee8733..0952ed1dce 100644
--- a/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js
+++ b/html5/verto/verto_communicator/src/vertoApp/vertoApp.module.js
@@ -54,8 +54,19 @@
}
]);
- vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt',
- function($rootScope, $location, toastr, prompt) {
+ vertoApp.run(['$rootScope', '$location', 'toastr', 'prompt', 'verto',
+ function($rootScope, $location, toastr, prompt, verto) {
+
+ $rootScope.$on( "$routeChangeStart", function(event, next, current) {
+ if (!verto.data.connected) {
+ if ( next.templateUrl === "partials/login.html") {
+ // pass
+ } else {
+ $location.path("/");
+ }
+ }
+ });
+
$rootScope.$on('$routeChangeSuccess', function(event, current, previous) {
$rootScope.title = current.$$route.title;
});
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js
index 2cc4c98312..2944cae46d 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/DialPadController.js
@@ -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;
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js
index 3dda64de89..d6f1d0366f 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/LoginController.js
@@ -11,7 +11,7 @@
}
}
preRoute();
-
+
verto.data.name = $scope.storage.data.name;
verto.data.email = $scope.storage.data.email;
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js
index fc403843ec..db8475f957 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js
@@ -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) {
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js
index a26ead6be2..fdc96efd59 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/SplashScreenController.js
@@ -18,7 +18,7 @@
link = activity;
}
}
-
+
$location.path(link);
}
@@ -77,6 +77,7 @@
redirectTo('/dialpad');
} else {
redirectTo('/login');
+ $location.path('/login');
}
});
diff --git a/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js b/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js
new file mode 100644
index 0000000000..71c48bcefa
--- /dev/null
+++ b/html5/verto/verto_communicator/src/vertoService/services/eventQueueService.js
@@ -0,0 +1,50 @@
+'use strict';
+
+ angular
+ .module('vertoService')
+ .service('eventQueue', ['$rootScope', '$q', 'storage', 'verto',
+ function($rootScope, $q, storage, verto) {
+
+ var events = [];
+
+ var next = function() {
+ var fn, fn_return;
+
+ fn = events.shift();
+
+ if (fn == undefined) {
+ $rootScope.$emit('eventqueue.complete');
+ return;
+ }
+ fn_return = fn();
+
+ var emitNextProgress = function() {
+ $rootScope.$emit('eventqueue.next');
+ };
+
+ fn_return.then(
+ function() {
+ emitNextProgress();
+ },
+ function() {
+ emitNextProgress();
+ }
+ );
+ };
+
+ var process = function() {
+ $rootScope.$on('eventqueue.next', function (ev){
+ next();
+ });
+
+ next();
+ };
+
+ return {
+ 'next': next,
+ 'process': process,
+ 'events': events
+ };
+
+ }]);
+