summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-07-14 16:51:33 -0400
committerPliablePixels <pliablepixels@gmail.com>2015-07-14 16:51:33 -0400
commit3dbe41f90b5e7058ec0fb5460516812143d4f254 (patch)
tree504e2e7db347bcfe889982e383ebef270f83d96f /www/js
parentd8c2874b6806f5d196b01fc6b3d5ea0bc7efa952 (diff)
reloading page on resume to take care of inactive modals. Not ideal, but better than inactive screens
Diffstat (limited to 'www/js')
-rw-r--r--www/js/ModalCtrl.js4
-rw-r--r--www/js/app.js35
2 files changed, 25 insertions, 14 deletions
diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js
index cce6db09..e8910585 100644
--- a/www/js/ModalCtrl.js
+++ b/www/js/ModalCtrl.js
@@ -7,8 +7,10 @@
angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', function ($scope, $rootScope, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate) {
- console.log("**** INSIDE MODAL CTRL *****");
+ console.log("**** INSIDE MODAL CTRL, recomputing rand *****");
+ $scope.rand = Math.floor((Math.random() * 100000) + 1);
+ //$state.go($state.current, {}, {reload: true});
// This holds the PTZ menu control
// Note that I hacked radialMenu
diff --git a/www/js/app.js b/www/js/app.js
index 2fd4df44..ad047864 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -165,7 +165,7 @@ angular.module('zmApp', [
// First run in ionic
//------------------------------------------------------------------
-.run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger,$timeout, $ionicHistory)
+.run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger,$timeout, $ionicHistory, $window)
{
ZMDataModel.init();
@@ -178,18 +178,17 @@ angular.module('zmApp', [
}
- /* $ionicPlatform.registerBackButtonAction(function (event) {
- console.log ("STATE NAME IS " + $ionicHistory.currentStateName());
- $ionicHistory.goBack();
- /*
- if($ionicHistory.currentStateName() == "myiew"){
- $ionicPlatform.exitApp();
- // or do nothing
- }
- else {
- $ionicHistory.goBack();
- }
- }, 100);*/
+ $ionicPlatform.registerBackButtonAction(function (event) {
+ console.log("STATE NAME IS " + $ionicHistory.currentStateName());
+
+ if ($ionicHistory.currentStateName() == "whatd do I put here?") {
+ $ionicPlatform.exitApp();
+
+ } else {
+ // do something else
+
+ }
+}, 100);
// this works reliably on both Android and iOS. The "onorientation" seems to reverse w/h in Android. Go figure.
// http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript
@@ -298,10 +297,20 @@ angular.module('zmApp', [
console.log("****The application is resuming from the background");
ZMDataModel.zmLog("App is resuming from background");
$rootScope.rand = Math.floor((Math.random() * 100000) + 1);
+ //$scope.rand = Math.floor((Math.random() * 100000) + 1);
console.log("** generated Random of " + $rootScope.rand);
$state.go($state.current, {}, {
reload: true
});
+ //$window.location.reload(true);
+ //$route.reload();
+
+ // This sort of solves the problem of inactive windows
+ // if you switch the screen off and on
+ // not ideal as reload removes the Modal and shows the view
+ // but better than an inactive/unresponsive screen
+ // FIXME: see if we can get the modal back
+ $window.location.reload();
zmAutoLogin.stop(); //safety
zmAutoLogin.start();
}, false);