From 72506316bccef298f82040e8531e538cf47bbf54 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 25 Jul 2018 14:07:41 -0400 Subject: fix currentServerVersion persistency --- www/js/DataModel.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index ee0603e5..49fb2460 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -15,7 +15,6 @@ angular.module('zmApp.controllers') $ionicPopup, $localstorage, $state, $ionicNativeTransitions, $translate) { var currentServerMultiPortSupported = false; - var currentServerVersion = ''; var zmAppVersion = "unknown"; var isBackground = false; @@ -178,6 +177,7 @@ angular.module('zmApp.controllers') 'insertBasicAuthToken': false, 'loginAPISupported': false, 'montageResizeSteps': 5, + 'currentServerVersion': '', }; @@ -349,10 +349,10 @@ angular.module('zmApp.controllers') return d.promise; } - if (currentServerVersion && (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { + if (loginData.currentServerVersion && (versionCompare(loginData.currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { myurl = loginData.apiurl + '/host/getCredentials.json'; - debug("Server version " + currentServerVersion+ " > 1.31.41, so using getCredentials API:" + myurl); + debug("Server version " + loginData.currentServerVersion+ " > 1.31.41, so using getCredentials API:" + myurl); $http.get(myurl) .then(function (s) { @@ -594,7 +594,8 @@ angular.module('zmApp.controllers') } function setCurrentServerVersion(val) { - currentServerVersion = val; + loginData.currentServerVersion = val; + setLogin(loginData); debug("Setting server version to:" + val); } @@ -626,7 +627,7 @@ angular.module('zmApp.controllers') }, getCurrentServerVersion: function () { - return (currentServerVersion); + return (loginData.currentServerVersion); }, @@ -2648,9 +2649,9 @@ angular.module('zmApp.controllers') $rootScope.authSession = "undefined"; -// console.log ("CURRENT SERVER: "+currentServerVersion); + console.log ("CURRENT SERVER: "+loginData.currentServerVersion); - if (currentServerVersion && (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { + if (loginData.currentServerVersion && (versionCompare(loginData.currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { debug ("Logging out using API method"); $http.get(loginData.apiurl+'/host/logout.json') -- cgit v1.2.3