]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8247 [verto_communicator] Waiting for server reconnection.
authorStefan Yohansson <stefan@evolux.net.br>
Mon, 5 Oct 2015 21:02:07 +0000 (18:02 -0300)
committerStefan Yohansson <stefan@evolux.net.br>
Mon, 5 Oct 2015 21:02:07 +0000 (18:02 -0300)
html5/verto/verto_communicator/src/index.html
html5/verto/verto_communicator/src/partials/ws_reconnect.html [new file with mode: 0644]
html5/verto/verto_communicator/src/vertoControllers/controllers/MainController.js
html5/verto/verto_communicator/src/vertoControllers/controllers/ModalWsReconnectController.js [new file with mode: 0644]
html5/verto/verto_communicator/src/vertoService/services/vertoService.js

index 3727a866c2d1d1658c5f6e62c7f9c7e1284a5e25..a1594f8a7fd553f5448bef169c99b313af669d71 100644 (file)
     <script type="text/javascript" src="src/vertoControllers/controllers/MainController.js"></script>
     <script type="text/javascript" src="src/vertoControllers/controllers/MenuController.js"></script>
     <script type="text/javascript" src="src/vertoControllers/controllers/ModalDialpadController.js"></script>
+    <script type="text/javascript" src="src/vertoControllers/controllers/ModalWsReconnectController.js"></script>
     <script type="text/javascript" src="src/vertoControllers/controllers/ModalLoginInformationController.js"></script>
     <script type="text/javascript" src="src/vertoControllers/controllers/ModalSettingsController.js"></script>
 
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 (file)
index 0000000..7879b58
--- /dev/null
@@ -0,0 +1,9 @@
+<div class="modal-header">
+<h3 class="modal-title">Waiting for server reconnection.</h3>
+</div>
+<div class="modal-body">
+  
+</div>
+<div class="modal-footer">
+</div>
+
index 1b8e58391e590f8bbfe41d329a70d3c774bc8c22..daa9b95b69e47669da05e83216d59749d18b3599 100644 (file)
         );
       };
 
-      $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) {
             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 (file)
index 0000000..374ad18
--- /dev/null
@@ -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'); 
+    };
+                
+                
+})();
index 888383c0f742bce0671f1c883154bc900bc1c24e..f59a5e13875654ecd2de06f89bff0d0af29222df 100644 (file)
@@ -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) {