diff options
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/EventCtrl.js | 38 | ||||
| -rwxr-xr-x | www/js/app.js | 2 |
2 files changed, 34 insertions, 6 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index b0d61180..5cf91eb3 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -127,13 +127,29 @@ angular.module('zmApp.controllers') }, 100); - /* NVR.debug ("Starting page refresh timer"); + NVR.debug ("Starting page refresh timer"); + $interval.cancel(intervalReloadEvents); intervalReloadEvents = $interval(function () { - doRefresh(); - }.bind(this), 10 * 1000);*/ + timedPageReload(); + }.bind(this), zm.eventPageRefresh); }); + function timedPageReload() { + + + if ($ionicScrollDelegate.$getByHandle("mainScroll").getScrollPosition().top !=0 ) { + NVR.debug ("Not reloading as you have scrolled"); + + } + else if ($scope.modal != undefined && $scope.modal.isShown()) { + NVR.debug ("Not reloading as you have a modal open"); + } + else { + doRefresh(); + } + + } function playSpecificEvent(eid) { NVR.log("Stuffing EID to play back " + eid); @@ -153,8 +169,8 @@ angular.module('zmApp.controllers') $scope.$on('$ionicView.beforeLeave', function () { - /*NVR.debug ("Cancelling page reload timer"); - $interval.cancel(intervalReloadEvents);*/ + NVR.debug ("Cancelling page reload timer"); + $interval.cancel(intervalReloadEvents); NVR.debug("EventCtrl: Deregistering resize listener"); window.removeEventListener("resize", recomputeThumbSize, false); //NVR.debug("EventCtrl: Deregistering broadcast handles"); @@ -171,6 +187,18 @@ angular.module('zmApp.controllers') $scope.mid = ''; + $scope.$on ("alarm", function() { + NVR.debug ("EventCtrl: new event notiication, doing an immediate reload"); + // do an immediate display reload and schedule timer again + $interval.cancel(intervalReloadEvents); + timedPageReload(); + intervalReloadEvents = $interval(function () { + timedPageReload(); + }.bind(this), zm.eventPageRefresh); + + + }); + $scope.$on ( "process-push", function () { NVR.debug (">> EventCtrl: push handler"); var s = NVR.evaluateTappedNotification(); diff --git a/www/js/app.js b/www/js/app.js index 0b377420..ffd456fe 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -83,7 +83,7 @@ angular.module('zmApp', [ nphSwitchTimer: 3000, eventHistoryTimer: 5000, eventPlaybackQuery: 3000, - + eventPageRefresh: 30000, // 30s packeryTimer: 500, dbName: 'zmninja', cipherKey: 'sdf#@#%FSXSA_AR', |
