diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-09 10:47:55 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2018-09-09 10:47:55 -0400 |
| commit | fd317367ce221b83137e6198b30159caf4b129ce (patch) | |
| tree | 3e8aa78f48ce38269ef53cd95897037a17fa44db /www/js | |
| parent | 33025d65e1e79041b8d4f1f4ab830ab9d2ebd667 (diff) | |
#701 moved to electron-build
Diffstat (limited to 'www/js')
| -rw-r--r--[-rwxr-xr-x] | www/js/DataModel.js | 6 | ||||
| -rwxr-xr-x | www/js/app.js | 41 |
2 files changed, 41 insertions, 6 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js index eb5cd7d7..ea8bd9b2 100755..100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -16,7 +16,11 @@ angular.module('zmApp.controllers') var currentServerMultiPortSupported = false; - var zmAppVersion = "unknown"; + /* + DO NOT TOUCH zmAppVersion + It is changed by sync_version.sh + */ + var zmAppVersion = "1.3.018"; var isBackground = false; var justResumed = false; var timeSinceResumed = -1; diff --git a/www/js/app.js b/www/js/app.js index 3b907780..ccc9593e 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1458,10 +1458,14 @@ angular.module('zmApp', [ NVRDataModel.debug("**EXCEPTION**" + error.reason + " caused by " + error.cause); }; - if ($rootScope.platformOS == 'desktop') { + + if ($rootScope.platformOS == 'desktop' && 0) { window.addEventListener('beforeunload', function (ev) { + // I don't think this works on windows + // the callback is not called, it seems + // This was causing android reload issues - holy palooza /* if ($rootScope.platformOS != 'desktop') { ev.returnValue = "true"; @@ -1480,7 +1484,7 @@ angular.module('zmApp', [ }); }); - } + } // DPAD Handler - disabled for now // when ready add ionic cordova plugin add https://github.com/pliablepixels/cordova-plugin-android-tv.git @@ -1707,7 +1711,7 @@ angular.module('zmApp', [ $rootScope.dpadId = 0; - //console.log("HERE"); + if ($rootScope.apiValid == false && toState.name != 'app.invalidapi' && toState.data.requireLogin == true) { event.preventDefault(); @@ -1717,8 +1721,15 @@ angular.module('zmApp', [ } + + if (NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) { //console.log("State transition is authorized"); + NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState)); + localforage.setItem('last-desktop-state', { + 'name': toState.name, + 'params': toState.params + }); $rootScope.dpadState = toState.name.replace("app.", ""); return; } else { @@ -1745,6 +1756,16 @@ angular.module('zmApp', [ return; } + // right about now, store last-state as the callback doesn't seem + // to work in Windows + + + NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState)); + localforage.setItem('last-desktop-state', { + 'name': toState, + 'params': toParams + }); + return; }); @@ -2000,20 +2021,30 @@ angular.module('zmApp', [ localforage.getItem('last-desktop-state') .then(function (succ) { - //console.log ("FOUND STATE" + JSON.stringify(succ) + ":"+succ); + console.log ("FOUND STATE" + JSON.stringify(succ) + ":"+succ); + + // sanitize this + if (!succ.name || typeof succ.name !== 'string') {succ.name = "app.montage"}; + + if (!succ.params) {succ.params = {}}; if (succ) { - if (succ.name == 'app.invalidapi' || succ.name == 'app.refresh' || succ.name == 'app.importantmessage') { + if (succ.name == 'app.invalidapi' || succ.name == 'app.refresh' || succ.name == 'app.importantmessage' || succ.name == "app.first-use" || !succ.name) { succ.name = 'app.montage'; + localforage.setItem('last-desktop-state', succ.name); } $rootScope.lastState = succ.name; if ($rootScope.lastState.indexOf("app.") == -1) { $rootScope.lastState = "app." + $rootScope.lastState; + + } $rootScope.lastStateParam = succ.params; NVRDataModel.debug("last state=" + $rootScope.lastState + " param=" + $rootScope.lastStateParam); + + } loadServices(); }, function (err) { |
