Skip to content

Commit

Permalink
#779 - refresh every 30s as well as when we get new events. But don't…
Browse files Browse the repository at this point in the history
… refresh if you are looking at something else
  • Loading branch information
pliablepixels committed Feb 9, 2019
1 parent 961c5b9 commit af96813
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.042" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.3.043" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>zmNinja</name>
<description>
High performance ZoneMinder client
Expand Down Expand Up @@ -178,5 +178,5 @@
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<engine name="android" spec="7.1.4" />
<engine name="ios" spec="~4.5.5" />
<engine name="ios" spec="4.5.5" />
</widget>
38 changes: 33 additions & 5 deletions www/js/EventCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ angular.module('zmApp', [
nphSwitchTimer: 3000,
eventHistoryTimer: 5000,
eventPlaybackQuery: 3000,

eventPageRefresh: 30000, // 30s
packeryTimer: 500,
dbName: 'zmninja',
cipherKey: 'sdf#@#%FSXSA_AR',
Expand Down

0 comments on commit af96813

Please sign in to comment.