From 2dcd736caf0cfd3fc4ff0a2841d486c795d6661d Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sun, 23 Sep 2018 14:17:04 -0400 Subject: wekwebview fixes --- www/js/app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 6287e09b..6ca4c9d0 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -1967,9 +1967,9 @@ angular.module('zmApp', [ $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; - if (window.cordova && window.cordova.plugins.Keyboard) { - // console.log("no keyboard"); - // cordova.plugins.Keyboard.disableScroll(true); + if (window.cordova ) { + console.log("------------->Keyboard foonone"); + //window.cordova.plugins.Keyboard.disableScroll(true); } if (window.StatusBar) { // org.apache.cordova.statusbar required @@ -2255,7 +2255,7 @@ angular.module('zmApp', [ }]); // If you do this, Allow Origin can't be * - //$httpProvider.defaults.withCredentials = true; + $httpProvider.defaults.withCredentials = true; $httpProvider.interceptors.push('timeoutHttpIntercept'); $ionicConfigProvider.navBar.alignTitle('center'); //$ionicConfigProvider.backButton.text('').icon('ion-chevron-left'); -- cgit v1.2.3 From 447d4aeaf3714b8d97765f74452d3cd59614cf28 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 24 Sep 2018 15:32:12 -0400 Subject: #709 remove native-trans (don't need to) --- www/js/app.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 6ca4c9d0..97132a21 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -25,7 +25,7 @@ angular.module('zmApp', [ 'com.2fdevs.videogular', 'com.2fdevs.videogular.plugins.controls', 'com.2fdevs.videogular.plugins.overlayplay', - 'ionic-native-transitions', + //'ionic-native-transitions', 'mgo-angular-wizard', 'pascalprecht.translate', 'uk.ac.soton.ecs.videogular.plugins.cuepoints', @@ -1380,7 +1380,7 @@ angular.module('zmApp', [ // First run in ionic //==================================================================== - .run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, NVRDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, zmCheckUpdates, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer, $ionicContentBanner, $ionicLoading, $ionicNativeTransitions, $translate, $localstorage) { + .run(function ($ionicPlatform, $ionicPopup, $rootScope, zm, $state, $stateParams, NVRDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, zmCheckUpdates, $fileLogger, $timeout, $ionicHistory, $window, $ionicSideMenuDelegate, EventServer, $ionicContentBanner, $ionicLoading, /* $ionicNativeTransitions,*/ $translate, $localstorage) { $ionicPlatform.ready(function () { @@ -2000,13 +2000,14 @@ angular.module('zmApp', [ // console.log("file logger"); - if (NVRDataModel.getLogin().disableNative) { + /*if (NVRDataModel.getLogin().disableNative) { NVRDataModel.log("Disabling native transitions..."); $ionicNativeTransitions.enable(false); } else { NVRDataModel.log("Enabling native transitions..."); $ionicNativeTransitions.enable(true); - } + }*/ + // At this stage, DataModel.init is not called yet // but I do need to know the language @@ -2230,7 +2231,7 @@ angular.module('zmApp', [ //------------------------------------------------------------------ // My route map connecting menu options to their respective templates and controllers - .config(function ($stateProvider, $urlRouterProvider, $httpProvider, $ionicConfigProvider, $provide, $compileProvider, $ionicNativeTransitionsProvider, $logProvider, $translateProvider) { + .config(function ($stateProvider, $urlRouterProvider, $httpProvider, $ionicConfigProvider, $provide, $compileProvider, /*$ionicNativeTransitionsProvider,*/ $logProvider, $translateProvider) { //$logProvider.debugEnabled(false); //$compileProvider.debugInfoEnabled(false); @@ -2265,10 +2266,11 @@ angular.module('zmApp', [ // so it messes up scrolldelegate zoom and possibly others //$ionicConfigProvider.scrolling.jsScrolling(false); $compileProvider.debugInfoEnabled(false); + $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|cdvphotolibrary):/); - $ionicNativeTransitionsProvider.setDefaultOptions({ + /*$ionicNativeTransitionsProvider.setDefaultOptions({ duration: 250, - }); + }); */ $translateProvider.useStaticFilesLoader({ prefix: 'lang/locale-', -- cgit v1.2.3 From d8fea09d65e5207ef8c4fafcddd5fc74a7f7be00 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 28 Sep 2018 08:37:24 -0400 Subject: #709 implement native/XHR wrapper, convert all success/error to "then" construct --- www/js/app.js | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 208 insertions(+), 8 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 97132a21..dfcade8f 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -264,7 +264,6 @@ angular.module('zmApp', [ }) - // credit https://gist.github.com/Zren/beaafd64f395e23f4604 .directive('mouseWheelScroll', function ($timeout) { @@ -322,7 +321,7 @@ angular.module('zmApp', [ //console.log ("requestConfig is " + JSON.stringify(requestConfig)); imageLoadingDataShare.set(1); $http(requestConfig) - .success(function (data) { + .then(function (data) { //console.log ("Inside HTTP after Calling " + requestConfig.url); //console.log ("data got " + JSON.stringify(data)); @@ -763,6 +762,9 @@ angular.module('zmApp', [ NVRDataModel.setLastUpdateCheck(moment().toISOString()); // $localstorage.set("lastUpdateCheck", moment().toISOString()); //console.log ("FULL STRING " + success.data.tag_name); + + // console.log ("^^^^^^^^^^^^^ GOT: " + JSON.stringify(success)); + var res = success.data.tag_name.match("v(.*)"); zmUpdateVersion = res[1]; var currentVersion = NVRDataModel.getAppVersion(); @@ -792,7 +794,7 @@ angular.module('zmApp', [ } }) - .success(function (datastr) { + .then(function (datastr) { var data = JSON.parse(datastr); $rootScope.newBlogPost = ""; @@ -1059,10 +1061,11 @@ angular.module('zmApp', [ $http({ - method:'POST', + method:'post', url: loginAPI, timeout:httpDelay, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, + responseType:'text', transformResponse: undefined, transformRequest: function(obj) { var str = []; @@ -1242,7 +1245,7 @@ angular.module('zmApp', [ //NVRDataModel.debug ("*** AUTH LOGIN URL IS " + loginData.url); $http({ - method: 'POST', + method: 'post', timeout: httpDelay, //withCredentials: true, url: loginData.url + '/index.php', @@ -1266,8 +1269,9 @@ angular.module('zmApp', [ view: "console" } }) - .success(function (data, status, headers) { + .then(function (data, status, headers) { // console.log(">>>>>>>>>>>>>> PARALLEL POST SUCCESS"); + data = data.data; $ionicLoading.hide(); // Coming here does not mean success @@ -1324,8 +1328,8 @@ angular.module('zmApp', [ return (d.promise); - }) - .error(function (error, status) { + }, + function (error, status) { // console.log(">>>>>>>>>>>>>> PARALLEL POST ERROR"); $ionicLoading.hide(); @@ -2255,6 +2259,202 @@ angular.module('zmApp', [ }; }]); + + $provide.decorator('$http', ['$delegate', '$q', function($delegate, $q) { + // create function which overrides $http function + var $http = $delegate; + + var wrapper = function () { + + + + var url; + var method; + + url = arguments[0].url; + method = arguments[0].method; + + + + console.log ("+++++ IN WRAPPER WITH "+method+" for "+url); + + var isOutgoingRequest = /^(http|https):\/\//.test(url); + + + if (window.cordova && isOutgoingRequest) { + console.log ("**** -->"+method+"<-- using native HTTP with:"+url); + console.log ("ARGUMENTS="+JSON.stringify(arguments)); + var d = $q.defer(); + + var options = { + method: method, + data: arguments[0].data, + headers: arguments[0].headers, + timeout: arguments[0].timeout, + responseType: arguments[0].responseType + + }; + + /* RGUMENTS={"0":{"method":"POST","timeout":7000,"url":"8889/zm/index.php","headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json"},"data":{"action":"logout","view":"login"}}}*/ + + cordova.plugin.http.sendRequest(encodeURI(url),options, + function (succ) { + console.log ("*** Inside native HTTP success with:"+JSON.stringify(succ)); + + try { + + + if (options.responseType =='text') + d.resolve({"data":succ.data}); + else + d.resolve({"data":JSON.parse(succ.data)}); + return d.promise; + + } + catch (e) { + d.resolve({"data":succ.data}); + return d.promise; + } + + }, + function (err) { + console.log ("*** Inside native HTTP error"); + d.reject(err); + return d.promise; + }); + return d.promise; + + } + else { + console.log ("**** "+method+" using XHR HTTP for "+url); + return $http.apply($http, arguments); + } + + + }; + + Object.keys($http).forEach( function (key) { + + console.log ("----> "+key+" IS "+typeof($http[key])); + }); + + + + Object.keys($http).filter(function (key) { + return (typeof $http[key] === 'function'); + }).forEach(function (key) { + wrapper[key] = function () { + + // Apply global changes to arguments, or perform other + // nefarious acts. + + // console.log ("KEY="+key); + + return $http[key].apply($http, arguments); + }; + }); + console.log ("*** WRAPPING EASY"); + $delegate.get = function (url,config) { + + return wrapper(angular.extend(config || {}, { + method: 'get', + url: url + })); + }; + + $delegate.post = function (url,config) { + + return wrapper(angular.extend(config || {}, { + method: 'post', + url: url + })); + }; + + $delegate.delete = function (url,config) { + + return wrapper(angular.extend(config || {}, { + method: 'delete', + url: url + })); + }; + + + return wrapper; + +/* + $delegate.post = function(args) { + var isOutgoingRequest = /^(http|https):\/\//.test(args); + + if (window.cordova && isOutgoingRequest) { + console.log ("**** POST using native HTTP2 with:"+args); + console.log ("POST ARGUMENTS="+JSON.stringify(arguments)); + var d = $q.defer(); + + var options = { + method: 'post', + + }; + + cordova.plugin.http.sendRequest(args,options, + function (succ) { + console.log ("*** POST Inside native HTTP success"); + + d.resolve({"data":JSON.parse(succ.data)}); + return d.promise; + }, + function (err) { + console.log ("*** POST Inside native HTTP error"); + d.reject(err); + return d.promise; + }); + return d.promise; + + } + else { + console.log ("**** POST using XHR HTTP with "+args); + return originalPost.apply(this, arguments); + } + + }; + + $delegate.get = function(args) { + var isOutgoingRequest = /^(http|https):\/\//.test(args); + if (window.cordova && isOutgoingRequest) { + console.log ("**** using native HTTP2 with:"+args); + console.log ("ARGUMENTS="+JSON.stringify(arguments)); + var d = $q.defer(); + + var options = { + method: 'get', + + }; + + cordova.plugin.http.sendRequest(args,options, + function (succ) { + console.log ("*** GET Inside native HTTP success"); + + d.resolve({"data":JSON.parse(succ.data)}); + return d.promise; + }, + function (err) { + console.log ("*** GET Inside native HTTP error"); + d.reject(err); + return d.promise; + }); + return d.promise; + + } + else { + console.log ("**** GET using XHR HTTP with:"+args); + return originalGet.apply(this, arguments); + } + + }; + + return $delegate; + */ + }]); + // If you do this, Allow Origin can't be * $httpProvider.defaults.withCredentials = true; $httpProvider.interceptors.push('timeoutHttpIntercept'); -- cgit v1.2.3 From ebe04f8fc791413131c37425998be5be4a2ef538 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 28 Sep 2018 14:29:43 -0400 Subject: #709 dont escape urls in caller, incorporate cordova http ssl and basic auth checks --- www/js/app.js | 169 +++++++++++++--------------------------------------------- 1 file changed, 38 insertions(+), 131 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index dfcade8f..1d12b353 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -785,16 +785,16 @@ angular.module('zmApp', [ NVRDataModel.log("Checking for news updates"); $http.get(zm.blogUrl, { - transformResponse: function (d, h) { - var trunc = "])}while(1);"; - if (d) { - d = d.substr(trunc.length); - } - return d; - } + responseType:'text', + transformResponse:undefined }) .then(function (datastr) { + // again, for cordova-http + + datastr = datastr.data; + var trunc = "])}while(1);"; + datastr = datastr.substr(trunc.length); var data = JSON.parse(datastr); $rootScope.newBlogPost = ""; @@ -2260,100 +2260,81 @@ angular.module('zmApp', [ }]); + // Wraps around $http that switches between browser XHR + // or cordova-advanced-http based on if cordova is available + // credits: + // a) https://www.exratione.com/2013/08/angularjs-wrapping-http-for-fun-and-profit/ + // b) https://gist.github.com/adamreisnz/354364e2a58786e2be71 + $provide.decorator('$http', ['$delegate', '$q', function($delegate, $q) { // create function which overrides $http function var $http = $delegate; var wrapper = function () { - - - var url; var method; url = arguments[0].url; method = arguments[0].method; - - - - console.log ("+++++ IN WRAPPER WITH "+method+" for "+url); - var isOutgoingRequest = /^(http|https):\/\//.test(url); - - if (window.cordova && isOutgoingRequest) { - console.log ("**** -->"+method+"<-- using native HTTP with:"+url); - console.log ("ARGUMENTS="+JSON.stringify(arguments)); + console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); var d = $q.defer(); - var options = { method: method, data: arguments[0].data, headers: arguments[0].headers, timeout: arguments[0].timeout, responseType: arguments[0].responseType - }; - /* RGUMENTS={"0":{"method":"POST","timeout":7000,"url":"8889/zm/index.php","headers":{"Content-Type":"application/x-www-form-urlencoded","Accept":"application/json"},"data":{"action":"logout","view":"login"}}}*/ - cordova.plugin.http.sendRequest(encodeURI(url),options, function (succ) { - console.log ("*** Inside native HTTP success with:"+JSON.stringify(succ)); - - try { - - - if (options.responseType =='text') - d.resolve({"data":succ.data}); - else - d.resolve({"data":JSON.parse(succ.data)}); - return d.promise; - - } - catch (e) { + // automatic JSON parse if no responseType: text + // fall back to text if JSON parse fails too + if (options.responseType =='text') { + // don't parse into JSON d.resolve({"data":succ.data}); return d.promise; } - + else { + try { + d.resolve({"data":JSON.parse(succ.data)}); + return d.promise; + } + catch (e) { + + console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); + d.resolve({"data":succ.data}); + return d.promise; + } + + } }, function (err) { - console.log ("*** Inside native HTTP error"); + console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); d.reject(err); return d.promise; }); return d.promise; } - else { + else { // not cordova, so lets go back to default http console.log ("**** "+method+" using XHR HTTP for "+url); return $http.apply($http, arguments); } - }; - Object.keys($http).forEach( function (key) { - - console.log ("----> "+key+" IS "+typeof($http[key])); - }); - - - + // wrap around all HTTP methods Object.keys($http).filter(function (key) { return (typeof $http[key] === 'function'); }).forEach(function (key) { wrapper[key] = function () { - - // Apply global changes to arguments, or perform other - // nefarious acts. - - // console.log ("KEY="+key); - return $http[key].apply($http, arguments); }; }); - console.log ("*** WRAPPING EASY"); + // wrap convenience functions $delegate.get = function (url,config) { return wrapper(angular.extend(config || {}, { @@ -2362,97 +2343,23 @@ angular.module('zmApp', [ })); }; - $delegate.post = function (url,config) { + $delegate.post = function (url,data,config) { return wrapper(angular.extend(config || {}, { method: 'post', - url: url + url: url, + data:data })); }; $delegate.delete = function (url,config) { - return wrapper(angular.extend(config || {}, { method: 'delete', url: url })); }; - return wrapper; - -/* - $delegate.post = function(args) { - var isOutgoingRequest = /^(http|https):\/\//.test(args); - - if (window.cordova && isOutgoingRequest) { - console.log ("**** POST using native HTTP2 with:"+args); - console.log ("POST ARGUMENTS="+JSON.stringify(arguments)); - var d = $q.defer(); - - var options = { - method: 'post', - - }; - - cordova.plugin.http.sendRequest(args,options, - function (succ) { - console.log ("*** POST Inside native HTTP success"); - - d.resolve({"data":JSON.parse(succ.data)}); - return d.promise; - }, - function (err) { - console.log ("*** POST Inside native HTTP error"); - d.reject(err); - return d.promise; - }); - return d.promise; - - } - else { - console.log ("**** POST using XHR HTTP with "+args); - return originalPost.apply(this, arguments); - } - - }; - - $delegate.get = function(args) { - var isOutgoingRequest = /^(http|https):\/\//.test(args); - if (window.cordova && isOutgoingRequest) { - console.log ("**** using native HTTP2 with:"+args); - console.log ("ARGUMENTS="+JSON.stringify(arguments)); - var d = $q.defer(); - - var options = { - method: 'get', - - }; - - cordova.plugin.http.sendRequest(args,options, - function (succ) { - console.log ("*** GET Inside native HTTP success"); - - d.resolve({"data":JSON.parse(succ.data)}); - return d.promise; - }, - function (err) { - console.log ("*** GET Inside native HTTP error"); - d.reject(err); - return d.promise; - }); - return d.promise; - - } - else { - console.log ("**** GET using XHR HTTP with:"+args); - return originalGet.apply(this, arguments); - } - - }; - - return $delegate; - */ }]); // If you do this, Allow Origin can't be * -- cgit v1.2.3 From 57920cc5d5e96780e13a29c04a577d4c67496aba Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 29 Sep 2018 11:50:53 -0400 Subject: #709 encorce AUTH_HASH_LOGIN for mobile --- www/js/app.js | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 1d12b353..77df01e7 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -908,6 +908,30 @@ angular.module('zmApp', [ contentBannerInstance(); }, 2000); NVRDataModel.debug("auth-success broadcast:Successful"); + + + var ld = NVRDataModel.getLogin(); + + // we need AUTH_HASH_LOGIN to be on for WKWebView /mobile + if (ld.isUseAuth && $rootScope.platformOS != 'desktop') { + NVRDataModel.getAuthHashLogin() + .then (function (data) { + + if (data.data && data.data.config.Value != '1') { + $ionicPopup.alert({ + title: $translate.instant('kError'), + template: $translate.instant('kAuthHashDisabled') + }); + } + + }, + function (err) { + console.log ("AUTH HASH ERROR: "+JSON.stringify(conf)); + }); + } + + + }); $rootScope.getProfileName = function () { @@ -2278,7 +2302,7 @@ angular.module('zmApp', [ method = arguments[0].method; var isOutgoingRequest = /^(http|https):\/\//.test(url); if (window.cordova && isOutgoingRequest) { - console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); + // console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); var d = $q.defer(); var options = { method: method, @@ -2304,7 +2328,7 @@ angular.module('zmApp', [ } catch (e) { - console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); + // console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); d.resolve({"data":succ.data}); return d.promise; } @@ -2312,7 +2336,8 @@ angular.module('zmApp', [ } }, function (err) { - console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); + //console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); + NVRDataModel.debug ("*** Native HTTP error: "+JSON.stringify(err)); d.reject(err); return d.promise; }); @@ -2320,7 +2345,7 @@ angular.module('zmApp', [ } else { // not cordova, so lets go back to default http - console.log ("**** "+method+" using XHR HTTP for "+url); + // console.log ("**** "+method+" using XHR HTTP for "+url); return $http.apply($http, arguments); } @@ -2336,7 +2361,6 @@ angular.module('zmApp', [ }); // wrap convenience functions $delegate.get = function (url,config) { - return wrapper(angular.extend(config || {}, { method: 'get', url: url @@ -2344,7 +2368,6 @@ angular.module('zmApp', [ }; $delegate.post = function (url,data,config) { - return wrapper(angular.extend(config || {}, { method: 'post', url: url, -- cgit v1.2.3 From 2ec04875077ddde824f3d051cd184349960cfa75 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 29 Sep 2018 11:57:44 -0400 Subject: #709 can't put factory in decorator --- www/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index 77df01e7..bcfe67c0 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -2337,7 +2337,7 @@ angular.module('zmApp', [ }, function (err) { //console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); - NVRDataModel.debug ("*** Native HTTP error: "+JSON.stringify(err)); + d.reject(err); return d.promise; }); -- cgit v1.2.3 From bace2be553e3175ba7a47024c8352e43d285b620 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 8 Oct 2018 12:14:32 -0400 Subject: log cleanup, wait for eventserver init before sending messages --- www/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index bcfe67c0..b3553664 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -2302,7 +2302,7 @@ angular.module('zmApp', [ method = arguments[0].method; var isOutgoingRequest = /^(http|https):\/\//.test(url); if (window.cordova && isOutgoingRequest) { - // console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); + //console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); var d = $q.defer(); var options = { method: method, @@ -2328,7 +2328,7 @@ angular.module('zmApp', [ } catch (e) { - // console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); + //console.log ("*** Native HTTP response: JSON parsing failed for "+url+", returning text"); d.resolve({"data":succ.data}); return d.promise; } -- cgit v1.2.3 From 5f89cfff2904b65d8adacb05b7edc8e9e2f356ff Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 10 Oct 2018 09:10:15 -0400 Subject: bump min ES to 2 --- www/js/app.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index b3553664..fe42b264 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -44,7 +44,7 @@ angular.module('zmApp', [ .constant('zm', { minAppVersion: '1.28.107', // if ZM is less than this, the app won't work recommendedAppVersion: '1.32.0', - minEventServerVersion: '1.0', + minEventServerVersion: '2.0', castAppId: 'BA30FB4C', alarmFlashTimer: 20000, // time to flash alarm gcmSenderId: '710936220256', @@ -2302,7 +2302,8 @@ angular.module('zmApp', [ method = arguments[0].method; var isOutgoingRequest = /^(http|https):\/\//.test(url); if (window.cordova && isOutgoingRequest) { - //console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)); + + var d = $q.defer(); var options = { method: method, @@ -2311,7 +2312,7 @@ angular.module('zmApp', [ timeout: arguments[0].timeout, responseType: arguments[0].responseType }; - + console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)+" payload:"+JSON.stringify(options)); cordova.plugin.http.sendRequest(encodeURI(url),options, function (succ) { // automatic JSON parse if no responseType: text @@ -2336,7 +2337,7 @@ angular.module('zmApp', [ } }, function (err) { - //console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); + console.log ("*** Inside native HTTP error: "+JSON.stringify(err)); d.reject(err); return d.promise; -- cgit v1.2.3 From f6be92a7c14d600fa1345a55de76bda706b84380 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sun, 14 Oct 2018 14:39:37 -0400 Subject: migrate websockets to native --- www/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index fe42b264..5935ee0d 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -2312,7 +2312,7 @@ angular.module('zmApp', [ timeout: arguments[0].timeout, responseType: arguments[0].responseType }; - console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)+" payload:"+JSON.stringify(options)); + // console.log ("**** -->"+method+"<-- using native HTTP with:"+encodeURI(url)+" payload:"+JSON.stringify(options)); cordova.plugin.http.sendRequest(encodeURI(url),options, function (succ) { // automatic JSON parse if no responseType: text -- cgit v1.2.3