diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/EventServer.js | 77 | ||||
| -rw-r--r-- | www/js/app.js | 2 |
2 files changed, 36 insertions, 43 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js index a9b44a8f..ff2f9026 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -168,21 +168,28 @@ angular.module('zmApp.controllers') if (str.status == 'Success' && str.event == 'alarm') // new events { - - new Audio('sounds/blop.mp3').play(); - var localNotText = "Latest Alarms: "; - $rootScope.isAlarm = 1; + var localNotText; + // ZMN specific hack for Event Server + if (str.supplementary != 'true') + { + new Audio('sounds/blop.mp3').play(); + localNotText = "Latest Alarms: "; + $rootScope.isAlarm = 1; + + // Show upto a max of 99 when it comes to display + // so aesthetics are maintained + if ($rootScope.alarmCount == "99") { + $rootScope.alarmCount = "99+"; + } + if ($rootScope.alarmCount != "99+") { + $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); + } - // Show upto a max of 99 when it comes to display - // so aesthetics are maintained - if ($rootScope.alarmCount == "99") { - $rootScope.alarmCount = "99+"; } - if ($rootScope.alarmCount != "99+") { - $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); + else + { + ZMDataModel.zmDebug("received supplementary event information over websockets"); } - - var eventsToDisplay = []; var listOfMonitors=[]; for (var iter = 0; iter < str.events.length; iter++) { @@ -200,40 +207,26 @@ angular.module('zmApp.controllers') //emit alarm details - this is when received over websockets $rootScope.$emit('alarm',{message:listOfMonitors}); - ZMDataModel.zmDebug("App is in foreground, displaying banner"); - if (eventsToDisplay.length > 0) { - - if (eventsToDisplay.length == 1) { - console.log("Single Display: " + eventsToDisplay[0]); - ZMDataModel.displayBanner('alarm', [eventsToDisplay[0]], 5000, 5000); - } else { - ZMDataModel.displayBanner('alarm', eventsToDisplay, 5000, 5000 * eventsToDisplay.length); - } + + if (str.supplementary != 'true') + { + + ZMDataModel.zmDebug("App is in foreground, displaying banner"); + if (eventsToDisplay.length > 0) { + + if (eventsToDisplay.length == 1) { + console.log("Single Display: " + eventsToDisplay[0]); + ZMDataModel.displayBanner('alarm', [eventsToDisplay[0]], 5000, 5000); + } else { + ZMDataModel.displayBanner('alarm', eventsToDisplay, + 5000, 5000 * eventsToDisplay.length); + } + } } } - /* if (!$ionicPlatform.is('ios') ) - { - // this is only used for local notifications which is not - // used for iOS - // lets set badge of app irrespective of background or foreground - $cordovaBadge.hasPermission().then(function (yes) { - - $cordovaBadge.set($rootScope.alarmCount).then(function () { - // You have permission, badge set. - ZMDataModel.zmDebug("Setting badge to " + $rootScope.alarmCount); - }, function (err) { - // You do not have permission. - ZMDataModel.zmDebug("Error Setting badge to " + $rootScope.alarmCount); - }); - - - // You have permission - }, function (no) { - ZMDataModel.zmDebug("zmNinja does not have badge permissions. Please check your phone notification settings"); - }); - }*/ + } //end of success handler diff --git a/www/js/app.js b/www/js/app.js index 8cb5e869..b51578a0 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -33,7 +33,7 @@ angular.module('zmApp', [ .constant('zm', { minAppVersion: '1.28.107', // if ZM is less than this, the app won't work - minEventServerVersion: '0.4', + minEventServerVersion: '0.5', alarmFlashTimer:20000, // time to flash alarm gcmSenderId:'710936220256', httpTimeout: 15000, |
