diff options
| -rw-r--r-- | www/js/EventServer.js | 2 | ||||
| -rw-r--r-- | www/js/PortalLoginCtrl.js | 30 | ||||
| -rwxr-xr-x | www/js/app.js | 33 |
3 files changed, 35 insertions, 30 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js index a67d5426..68c21e9a 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -478,6 +478,7 @@ angular.module('zmApp.controllers') // console.log("*********** MEDIA BLOG IS " + mediasrc); media = $cordovaMedia.newMedia(mediasrc); + push.on('registration', function (data) { pushInited = true; NVRDataModel.debug("Push Notification registration ID received: " + JSON.stringify(data)); @@ -548,6 +549,7 @@ angular.module('zmApp.controllers') push.on('notification', function (data) { $ionicPlatform.ready(function () { + NVRDataModel.log("******* notification handler device ready"); NVRDataModel.debug("received push notification"); var ld = NVRDataModel.getLogin(); diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js index fb317e5b..40dc446e 100644 --- a/www/js/PortalLoginCtrl.js +++ b/www/js/PortalLoginCtrl.js @@ -8,6 +8,7 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic var broadcastHandles = []; var processPush = false; + var alreadyTransitioned = false; $scope.$on('$ionicView.beforeLeave', function () { processPush = false; @@ -24,13 +25,38 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic broadcastHandles = []; }); + + $scope.$on('$ionicView.beforeEnter', + function () { + alreadyTransitioned = false; + + }); + + $scope.$on('$ionicView.enter', function () { $scope.$on ( "process-push", function () { processPush = true; - NVRDataModel.debug (">> PortalLogin: push handler, marking to resolve later"); + + if (!alreadyTransitioned) { + NVRDataModel.debug (">> PortalLogin: push handler, marking to resolve later"); + + } + else { + NVRDataModel.debug (">> PortalLoginCtrl: push handler"); + processPush = false; + var s = NVRDataModel.evaluateTappedNotification(); + NVRDataModel.debug("tapped Notification evaluation:"+ JSON.stringify(s)); + $ionicHistory.nextViewOptions({ + disableAnimate:true, + disableBack: true + }); + $state.go(s[0],s[1],s[2]); + return; + + } }); @@ -260,6 +286,8 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic //NVRDataModel.debug ("logging state transition"); NVRDataModel.debug("2nd Auth: Transitioning state to: " + statetoGo + " with param " + JSON.stringify($rootScope.lastStateParam)); + + alreadyTransitioned = true; $state.go(statetoGo, $rootScope.lastStateParam); return; diff --git a/www/js/app.js b/www/js/app.js index 332c4613..74f7d0cf 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1437,6 +1437,7 @@ angular.module('zmApp', [ $ionicPlatform.ready(function () { //console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>INSIDE RUN"); + NVRDataModel.log("******* app .run device ready"); $fileLogger.setStorageFilename(zm.logFile); $fileLogger.setTimestampFormat('MMM d, y ' + NVRDataModel.getTimeFormatSec()); @@ -1475,26 +1476,6 @@ angular.module('zmApp', [ NVRDataModel.log("You are running on " + $rootScope.platformOS); - /*if (window.cordova && $rootScope.platformOS == 'android') { - - cordova.plugins.diagnostic.isExternalStorageAuthorized(function (authorized) { - if (!authorized) cordova.plugins.diagnostic.requestExternalStorageAuthorization(okperm, nopermerr); - }, function (err) { - console.log("diagnostic external storage error " + err); - }); - - - }*/ - - - function nopermerr() { - NVRDataModel.displayBanner('error', ['Storage permission must be allowed'], "", 4000); - } - - function okperm() { - //console.log("cool"); - NVRDataModel.displayBanner('success', ['Storage permission acquired'], "", 4000); - } $rootScope.appName = "zmNinja"; $rootScope.zmGlobalCookie = ""; @@ -1695,8 +1676,6 @@ angular.module('zmApp', [ function onOffline() { - - $timeout(function () { $rootScope.online = false; NVRDataModel.log("************** Your network went offline"); @@ -1704,14 +1683,10 @@ angular.module('zmApp', [ //$rootScope.$emit('network-change', "offline"); }); - } function onOnline() { - $timeout(function () { - - if ($rootScope.online == true) { NVRDataModel.log ("**** network online, but looks like it was not offline, not doing anything"); return; @@ -1719,9 +1694,7 @@ angular.module('zmApp', [ NVRDataModel.log("************ Your network came back online"); $rootScope.online = true; - - - + var networkState = "browser not supported"; if (navigator.connection) networkState = navigator.connection.type; NVRDataModel.debug("Detected network type as: " + networkState); @@ -2198,10 +2171,12 @@ angular.module('zmApp', [ function resumeHandler() { + NVRDataModel.setBackground(false); NVRDataModel.setJustResumed(true); $ionicPlatform.ready(function () { + NVRDataModel.log("******* resumeHandler device ready"); NVRDataModel.log("App is resuming from background"); NVRDataModel.log ("-->Re-registering online/offine"); |
