diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-11 16:48:43 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-11 16:48:43 -0400 |
| commit | f1e7435932fe33d3b64545279fcefe81a7544594 (patch) | |
| tree | d56237b541efae13b572628e71dd1171ab423c69 /www/js/EventServer.js | |
| parent | 56d9ca5ea8da516106570ec3cd9034058a901e46 (diff) | |
local notification fix
Diffstat (limited to 'www/js/EventServer.js')
| -rw-r--r-- | www/js/EventServer.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js index e5e30f1a..1c7f7c01 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -64,7 +64,7 @@ angular.module('zmApp.controllers') } - var localNotText = "New Alarms:"; + var localNotText = "New Alarms: "; if (str.status == 'Success' && str.events) // new events { var eventsToDisplay=[]; @@ -93,7 +93,7 @@ angular.module('zmApp.controllers') ZMDataModel.zmDebug("App is in background, displaying localNotification"); localNotificationId--; - if ( localNotificationId == 0) // only slow last 5 + if ( localNotificationId == 0) // only show last 5 { localNotificationId = 5; @@ -101,9 +101,11 @@ angular.module('zmApp.controllers') if ($cordovaLocalNotification.isPresent(localNotificationId)) { - $cordovaLocalNotification.clear(localNotificationId); + ZMDataModel.zmDebug("Cancelling notification ID " + localNotificationId); + $cordovaLocalNotification.cancel(localNotificationId); } - + + ZMDataModel.zmDebug("Creating notification ID " + localNotificationId + " with " +localNotText); $cordovaLocalNotification.schedule({ id: localNotificationId, title: 'ZoneMinder Alarms', @@ -118,11 +120,13 @@ angular.module('zmApp.controllers') } // 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); }); |
