diff --git a/html5/verto/verto_communicator/src/index.html b/html5/verto/verto_communicator/src/index.html index 3727a866c2..a1594f8a7f 100644 --- a/html5/verto/verto_communicator/src/index.html +++ b/html5/verto/verto_communicator/src/index.html @@ -109,6 +109,7 @@ + diff --git a/html5/verto/verto_communicator/src/partials/ws_reconnect.html b/html5/verto/verto_communicator/src/partials/ws_reconnect.html new file mode 100644 index 0000000000..7879b587f7 --- /dev/null +++ b/html5/verto/verto_communicator/src/partials/ws_reconnect.html @@ -0,0 +1,9 @@ + + + + diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js index 1b8e58391e..daa9b95b69 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js @@ -128,12 +128,16 @@ ); }; - $rootScope.openModal = function(templateUrl, controller) { - var modalInstance = $modal.open({ + $rootScope.openModal = function(templateUrl, controller, _options) { + var options = { animation: $scope.animationsEnabled, templateUrl: templateUrl, controller: controller, - }); + }; + + angular.extend(options, _options); + + var modalInstance = $modal.open(options); modalInstance.result.then( function(result) { @@ -149,7 +153,33 @@ jQuery.material.init(); } ); + + return modalInstance; + }; + $rootScope.$on('ws.close', onWSClose); + $rootScope.$on('ws.login', onWSLogin); + + var ws_modalInstance; + + function onWSClose(ev, data) { + if(ws_modalInstance) { + return; + }; + var options = { + backdrop: 'static', + keyboard: false + }; + ws_modalInstance = $scope.openModal('partials/ws_reconnect.html', 'ModalWsReconnectController', options); + }; + + function onWSLogin(ev, data) { + if(!ws_modalInstance) { + return; + }; + + ws_modalInstance.close(); + ws_modalInstance = null; }; $scope.showAbout = function() { diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js new file mode 100644 index 0000000000..374ad18c8d --- /dev/null +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js @@ -0,0 +1,15 @@ +(function() { + 'use strict'; + + angular + .module('vertoControllers') + .controller('ModalWsReconnectController', ModalWsReconnectController); + + ModalWsReconnectController.$inject = ['$scope', 'storage', 'verto']; + + function ModalWsReconnectController($scope, storage, verto) { + console.debug('Executing ModalWsReconnectController'); + }; + + +})(); diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 888383c0f7..f59a5e1387 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -449,6 +449,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora var callbacks = { onWSLogin: function(v, success) { data.connected = success; + $rootScope.$emit('ws.login', success); console.debug('Connected to verto server:', success); if (angular.isFunction(callback)) { @@ -539,6 +540,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora onWSClose: function(v, success) { console.debug('onWSClose:', success); + + $rootScope.$emit('ws.close', success); }, onEvent: function(v, e) {