summaryrefslogtreecommitdiff
path: root/www/js/MonitorCtrl.js
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-06-26 11:25:06 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-06-26 11:25:06 -0400
commit0e83a778b541591ef468d7ebda1493a000a545e5 (patch)
treee891381b97791d98edbbd70af4963606d494e659 /www/js/MonitorCtrl.js
parent9972b3e9171a400d7fc239385b3e1e8c3fd1b9bc (diff)
Added option to keep screen on when viewing footage, also cleaned up invocation of cordova plugins when in desktop - it now checks so spurious errors don't show in logs
Diffstat (limited to 'www/js/MonitorCtrl.js')
-rw-r--r--www/js/MonitorCtrl.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js
index 0d65a891..7548624c 100644
--- a/www/js/MonitorCtrl.js
+++ b/www/js/MonitorCtrl.js
@@ -17,6 +17,8 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.monitors = message;
var loginData = ZMDataModel.getLogin();
monitorStateCheck();
+ console.log ("Setting Awake to "+ZMDataModel.getKeepAwake());
+ ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
$scope.openMenu = function () {
@@ -186,9 +188,16 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
console.log("**VIEW ** Monitor Ctrl Loaded");
});
+ //-------------------------------------------------------------------------
+ // Lets make sure we set screen dim properly as we enter
+ // The problem is we enter other states before we leave previous states
+ // from a callback perspective in ionic, so we really can't predictably
+ // 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.enter', function () {
console.log("**VIEW ** Monitor Ctrl Entered");
-
+ ZMDataModel.setAwake(false);
});
$scope.$on('$ionicView.leave', function () {
@@ -207,6 +216,8 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111;
// This is a modal to show the monitor footage
+ // We need to switch to always awake so the feed doesn't get interrupted
+ ZMDataModel.setAwake(ZMDataModel.getKeepAwake());
$ionicModal.fromTemplateUrl('templates/monitors-modal.html', {
scope: $scope,
@@ -263,6 +274,8 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
$scope.closeModal = function () {
console.log("Close & Destroy Monitor Modal");
+ // switch off awake, as liveview is finished
+ ZMDataModel.setAwake(false);
$scope.modal.remove();
};
@@ -395,6 +408,9 @@ angular.module('zmApp.controllers').controller('zmApp.MonitorCtrl', ['$ionicPopu
})(i);
}
}
+
+
+
$scope.doRefresh = function () {
console.log("***Pull to Refresh");
$scope.monitors = [];