summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-10-22 11:50:53 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-10-22 11:50:53 -0400
commitff613f8e6210d2c4cd2f8deacc0096e18aff2fcd (patch)
treedee024287af53b9c9189b6acd1b783fa0ef1a527 /www
parente3ee3eeeb220cfce88ddfdb2189ec6e49432565f (diff)
#725 move push handlers inside beforeEnter for better consistency
Diffstat (limited to 'www')
-rw-r--r--www/js/DevOptionsCtrl.js25
-rw-r--r--www/js/EventCtrl.js24
-rw-r--r--www/js/LogCtrl.js27
-rw-r--r--www/js/LoginCtrl.js26
-rw-r--r--www/js/MomentCtrl.js23
-rw-r--r--www/js/MonitorCtrl.js25
-rw-r--r--www/js/MontageCtrl.js25
-rw-r--r--www/js/MontageHistoryCtrl.js23
-rw-r--r--www/js/NewsCtrl.js27
-rw-r--r--www/js/PortalLoginCtrl.js16
-rw-r--r--www/js/StateCtrl.js27
-rw-r--r--www/js/TimelineCtrl.js24
-rw-r--r--www/js/WizardCtrl.js14
13 files changed, 185 insertions, 121 deletions
diff --git a/www/js/DevOptionsCtrl.js b/www/js/DevOptionsCtrl.js
index 5592baa3..1e194fab 100644
--- a/www/js/DevOptionsCtrl.js
+++ b/www/js/DevOptionsCtrl.js
@@ -10,17 +10,7 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope'
};
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> DevOptionsCtrl: push handler");
- 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]);
- });
-
+
//----------------------------------------------------------------
// Alarm notification handling
//----------------------------------------------------------------
@@ -58,6 +48,19 @@ angular.module('zmApp.controllers').controller('zmApp.DevOptionsCtrl', ['$scope'
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
$scope.$on('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> DevOptionsCtrl: push handler");
+ 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]);
+ });
+
+
//console.log("**VIEW ** DevOptions Ctrl Entered");
$scope.loginData = NVRDataModel.getLogin();
console.log("DEV LOGS=" + $scope.loginData.enableLogs);
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index ef70fcf6..a037c7ee 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -72,17 +72,7 @@ angular.module('zmApp.controllers')
//---------------------------------------------------
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> EventCtrl: push handler");
- 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]);
- });
-
+
//we come here is TZ is updated after the view loads
var tzu = $scope.$on('tz-updated', function () {
@@ -171,6 +161,18 @@ angular.module('zmApp.controllers')
//console.log ("********* BEFORE ENTER");
//
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> EventCtrl: push handler");
+ 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]);
+ });
+
+
$scope.modalData = {
"doRefresh": false
};
diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js
index 9a84661a..2858e289 100644
--- a/www/js/LogCtrl.js
+++ b/www/js/LogCtrl.js
@@ -26,16 +26,7 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo
loadLogs();
}
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> LogCtrl: push handler");
- 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]);
- });
+
$scope.flipLogs = function () {
if ($scope.logEntity == 'ZoneMinder')
@@ -267,6 +258,22 @@ angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$roo
// reset power state on exit as if it is called after we enter another
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
+
+
+ $scope.$on('$ionic.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> LogCtrl: push handler");
+ 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]);
+ });
+ });
+
$scope.$on('$ionicView.enter', function () {
//console.log("**VIEW ** Log Ctrl Entered");
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index 0585f3c3..09a48ac2 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -33,17 +33,7 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
}
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> LoginCtrl: push handler. Not processing push, because you might be here due to login failure");
- /*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]);*/
- });
-
+
//----------------------------------------------------------------
// Alarm notification handling
//----------------------------------------------------------------
@@ -244,6 +234,20 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
$scope.$on('$ionicView.beforeEnter', function () {
+
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> LoginCtrl: push handler. Not processing push, because you might be here due to login failure");
+ /*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]);*/
+ });
+
+
oldLoginData = '';
$scope.loginData = NVRDataModel.getLogin();
diff --git a/www/js/MomentCtrl.js b/www/js/MomentCtrl.js
index d108010d..44f653df 100644
--- a/www/js/MomentCtrl.js
+++ b/www/js/MomentCtrl.js
@@ -23,16 +23,7 @@ angular.module('zmApp.controllers').controller('zmApp.MomentCtrl', ['$scope', '$
$ionicSideMenuDelegate.toggleLeft();
};
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> MomentCtrl: push handler");
- 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]);
- });
+
//----------------------------------------------------------------
// Alarm notification handling
@@ -844,6 +835,18 @@ angular.module('zmApp.controllers').controller('zmApp.MomentCtrl', ['$scope', '$
$scope.$on('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> MomentCtrl: push handler");
+ 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]);
+ });
+
//console.log ("HERE>>>>>>>>>>>>>>>>>>>>>>>>>>>");
monitors = angular.copy(message); // don't mess up the main monitors list
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index 6e2ce019..8926688b 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -48,16 +48,7 @@ angular.module('zmApp.controllers')
$ionicSideMenuDelegate.toggleLeft();
};
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> MonitorCtrl: push handler");
- 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]);
- });
+
//----------------------------------------------------------------
// Alarm notification handling
@@ -262,6 +253,20 @@ angular.module('zmApp.controllers')
// reset power state on exit as if it is called after we enter another
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
+
+ $scope.$on('$ionicView.beforeEnter', function() {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> MonitorCtrl: push handler");
+ 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]);
+ });
+ });
$scope.$on('$ionicView.enter', function () {
// console.log("**VIEW ** Monitor Ctrl Entered");
NVRDataModel.setAwake(false);
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index ec569943..0e3d34d0 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -47,17 +47,7 @@ angular.module('zmApp.controllers')
var broadcastHandles = [];
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> MontageCtrl: push handler");
- 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]);
- });
-
+
@@ -1830,6 +1820,19 @@ angular.module('zmApp.controllers')
// minimal has to be beforeEnter or header won't hide
$scope.$on('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> MontageCtrl: push handler");
+ 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]);
+ });
+
+
timeInMontage = new Date();
broadcastHandles = [];
randToAvoidCacheMem = new Date().getTime();
diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js
index ea9f7f2f..0373adcd 100644
--- a/www/js/MontageHistoryCtrl.js
+++ b/www/js/MontageHistoryCtrl.js
@@ -12,16 +12,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc
$scope.isScreenReady = false;
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> MontageHistoryCtrl: push handler");
- 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]);
- });
+
//--------------------------------------------------------------------------------------
// Handles bandwidth change, if required
@@ -1076,6 +1067,18 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc
}
}
$scope.$on('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> MontageHistoryCtrl: push handler");
+ 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]);
+ });
+
// This rand is really used to reload the monitor image in img-src so it is not cached
// I am making sure the image in montage view is always fresh
// I don't think I am using this anymore FIXME: check and delete if needed
diff --git a/www/js/NewsCtrl.js b/www/js/NewsCtrl.js
index d9850080..180f70d7 100644
--- a/www/js/NewsCtrl.js
+++ b/www/js/NewsCtrl.js
@@ -27,16 +27,7 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro
}
};
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> NewsCtrl: push handler");
- 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]);
- });
+
//-------------------------------------------------------------------------
// Lets make sure we set screen dim properly as we enter
@@ -45,6 +36,22 @@ angular.module('zmApp.controllers').controller('zmApp.NewsCtrl', ['$scope', '$ro
// reset power state on exit as if it is called after we enter another
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
+
+
+ $scope.$on ('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> NewsCtrl: push handler");
+ 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]);
+ });
+ });
+
$scope.$on('$ionicView.enter', function () {
// console.log("**VIEW ** News Ctrl Entered");
NVRDataModel.setAwake(false);
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index f514917e..fb317e5b 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -14,12 +14,7 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
});
- $scope.$on ( "process-push", function () {
- processPush = true;
- NVRDataModel.debug (">> PortalLogin: push handler, marking to resolve later");
-
- });
-
+
$scope.$on('$ionicView.beforeLeave', function () {
//NVRDataModel.debug("Portal: Deregistering broadcast handles");
@@ -31,6 +26,15 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
$scope.$on('$ionicView.enter',
function () {
+
+
+ $scope.$on ( "process-push", function () {
+ processPush = true;
+ NVRDataModel.debug (">> PortalLogin: push handler, marking to resolve later");
+
+ });
+
+
NVRDataModel.setJustResumed(false);
NVRDataModel.debug("Inside Portal login Enter handler");
diff --git a/www/js/StateCtrl.js b/www/js/StateCtrl.js
index 096df1e0..cef454a7 100644
--- a/www/js/StateCtrl.js
+++ b/www/js/StateCtrl.js
@@ -35,16 +35,7 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup'
getRunStatus();
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> StateCtrl: push handler");
- 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]);
- });
+
// Let's stagger this by 500ms each to see if Chrome lets these through
// This may also help if your Apache is not configured to let multiple connections through
@@ -72,6 +63,22 @@ angular.module('zmApp.controllers').controller('zmApp.StateCtrl', ['$ionicPopup'
// reset power state on exit as if it is called after we enter another
// state, that effectively overwrites current view power management needs
//------------------------------------------------------------------------
+
+
+ $scope.$on ('$ionicView.beforeEnter', function () {
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> StateCtrl: push handler");
+ 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]);
+ });
+ });
+
$scope.$on('$ionicView.enter', function () {
// console.log("**VIEW ** Montage Ctrl Entered");
NVRDataModel.setAwake(false);
diff --git a/www/js/TimelineCtrl.js b/www/js/TimelineCtrl.js
index f6125fb6..bfcb34da 100644
--- a/www/js/TimelineCtrl.js
+++ b/www/js/TimelineCtrl.js
@@ -21,17 +21,6 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
};
- $scope.$on ( "process-push", function () {
- NVRDataModel.debug (">> TimelineCtrl: push handler");
- 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]);
- });
-
//---------------------------------------f-------------------------
// Alarm notification handling
//----------------------------------------------------------------
@@ -318,6 +307,19 @@ angular.module('zmApp.controllers').controller('zmApp.TimelineCtrl', ['$ionicPla
$scope.$on('$ionicView.beforeEnter', function () {
+
+
+ $scope.$on ( "process-push", function () {
+ NVRDataModel.debug (">> TimelineCtrl: push handler");
+ 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]);
+ });
+
//$ionicHistory.clearCache();
//$ionicHistory.clearHistory();
timeline = '';
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js
index f4b3d456..fb76c64c 100644
--- a/www/js/WizardCtrl.js
+++ b/www/js/WizardCtrl.js
@@ -343,6 +343,20 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$
function logout(u) {
var d = $q.defer();
+ if (window.cordova) {
+ // we need to do this or ZM will send same auth hash
+ // this was fixed in a PR dated Oct 18
+ NVRDataModel.debug ("Clearing cookies");
+ cordova.plugin.http.clearCookies();
+
+ if ($scope.wizard.useauth && $scope.wizard.usebasicauth) {
+ NVRDataModel.debug ("setting basic auth");
+ cordova.plugin.http.useBasicAuth($scope.wizard.basicuser, $scope.wizard.basicpassword);
+
+ }
+ }
+
+
$http({
method: 'POST',
url: u,