diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-10 11:28:44 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-10-10 11:28:44 -0400 |
| commit | d0d3aaf7af63afa041e9af145267b0bb04ee729f (patch) | |
| tree | be718a451ed33afeead4d87c186fe231fe09a444 /www/js/app.js | |
| parent | 7b0d282994db52cc4bc6b62b33ce05efbb522fae (diff) | |
Notifications now have a blop sound, also handling application badges
Diffstat (limited to 'www/js/app.js')
| -rw-r--r-- | www/js/app.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/www/js/app.js b/www/js/app.js index 25cca497..113ec21b 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -5,6 +5,7 @@ var appVersion = "0.0.0"; + // core app start stuff angular.module('zmApp', [ 'ionic', @@ -459,7 +460,7 @@ angular.module('zmApp', [ // First run in ionic //------------------------------------------------------------------ -.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer) { +.run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer, $cordovaLocalNotification) { $rootScope.zmGlobalCookie = ""; $rootScope.isEventFilterOn = false; @@ -541,6 +542,13 @@ angular.module('zmApp', [ // generates and error in desktops but works fine ZMDataModel.zmLog("Device is ready"); console.log("**** DEVICE READY ***"); + + if (!$cordovaLocalNotification.hasPermission()) + { + ZMDataModel.zmDebug("Prompting for pushnotification permission"); + $cordovaLocalNotification.registerPermission(); + } + $fileLogger.checkFile().then(function (resp) { if (parseInt(resp.size) > zm.logFileMaxSize) { @@ -628,6 +636,7 @@ angular.module('zmApp', [ // from foreground to background and back document.addEventListener("resume", function () { ZMDataModel.zmLog("App is resuming from background"); + ZMDataModel.setBackground(false); // don't animate $ionicHistory.nextViewOptions({ disableAnimate: true, @@ -657,6 +666,7 @@ angular.module('zmApp', [ document.addEventListener("pause", function () { console.log("****The application is going into background"); ZMDataModel.zmLog("App is going into background"); + ZMDataModel.setBackground(true); zmAutoLogin.stop(); if ($rootScope.zmPopup) |
