From 29d31be0a4deca1030cc73260af7ef5e1f983d80 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 29 Jun 2018 10:00:35 -0400 Subject: #647 - fixed rootscope->rootScope, added fallback to window stop after 5 sec, if exitApp did not work, removed redundant multiport exit app --- www/js/app.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 516b11a1..4548e47a 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1880,6 +1880,7 @@ angular.module('zmApp', [ //---------------------------------------------------------------------------- document.addEventListener("resume", function () { + NVRDataModel.setBackground(false); NVRDataModel.setJustResumed(true); $ionicPlatform.ready(function () { NVRDataModel.log("App is resuming from background"); @@ -1887,7 +1888,7 @@ angular.module('zmApp', [ var ld = NVRDataModel.getLogin(); - NVRDataModel.setBackground(false); + // don't animate $ionicHistory.nextViewOptions({ disableAnimate: true, @@ -1954,21 +1955,32 @@ angular.module('zmApp', [ var ld = NVRDataModel.getLogin(); - if ($rootscope.platformOS == "android") { - NVRDataModel.log("force exiting app since its android"); - navigator.app.exitApp(); + if ($rootScope.platformOS == "android") { + NVRDataModel.log(" force exiting app since its android"); + //navigator.app.exitApp(); + $timeout (function () { + if (NVRDataModel.isBackground()) { + NVRDataModel.log ("If this shows up, then the app did not exit..."); + window.stop(); + } + else { + NVRDataModel.log ("window stop delay timeout called as part of pause, but app no longer in background"); + } + + + },5000); } - if (ld.exitOnSleep && $rootScope.platformOS == "android") { + /* if (ld.exitOnSleep && $rootScope.platformOS == "android") { NVRDataModel.log("user exited app"); navigator.app.exitApp(); // ionic.Platform.exitApp(); - } + }*/ - if (NVRDataModel.getCurrentServerMultiPortSupported() && $rootScope.platformOS == "android" && !NVRDataModel.isMultiPortDisabled()) { + /* if (NVRDataModel.getCurrentServerMultiPortSupported() && $rootScope.platformOS == "android" && !NVRDataModel.isMultiPortDisabled()) { NVRDataModel.log ("Multiport is active, killing app to make sure no streams continue in background..."); navigator.app.exitApp(); } else { @@ -1977,7 +1989,7 @@ angular.module('zmApp', [ NVRDataModel.debug ("platform:"+$rootScope.platformOS); NVRDataModel.debug ("isMultiPortDisabled:"+NVRDataModel.isMultiPortDisabled()); - } + }*/ if ($rootScope.zmPopup) $rootScope.zmPopup.close(); -- cgit v1.2.3