From fb215ba18d415bb00980530eba0a48c3e5216b7e Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Tue, 17 Dec 2019 11:01:53 -0500 Subject: #876 custom header --- www/js/app.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'www/js/app.js') diff --git a/www/js/app.js b/www/js/app.js index b5c2c6f4..3eb7210f 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -2,14 +2,7 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic, URI,Packery, ConnectSDK, CryptoJS, ContactFindOptions, localforage,$, Connection, MobileAccessibility, hello */ -// For desktop versions, this is replaced -// with actual app version from config.xml by the -// ./make_desktop.sh script -// For mobile versions, I use cordova app version plugin -// to get it at run time - -var appVersion = "0.0.0"; // core app start stuff angular.module('zmApp', [ @@ -662,12 +655,18 @@ angular.module('zmApp', [ request: function (config) { if (!config) return config; if (!config.url) return config; - + nvr = $injector.get('NVR'); if ($rootScope.basicAuthHeader) { config.headers.Authorization = $rootScope.basicAuthHeader; } + var chdr = nvr.getCustomHeader(); + if (chdr) { + config.headers['X-ZmNinja'] = chdr; + } + + return config || $q.when(config); }, @@ -1131,7 +1130,7 @@ angular.module('zmApp', [ - + $rootScope.dpadId = 0; $rootScope.textScaleFactor = 1.0; $rootScope.isLoggedIn = false; @@ -1765,11 +1764,16 @@ angular.module('zmApp', [ // console.log("app version"); cordova.getAppVersion.getVersionNumber().then(function (version) { - appVersion = version; - NVR.log("App Version: " + appVersion); - NVR.setAppVersion(appVersion); + + NVR.log("App Version: " + version); + NVR.setAppVersion(version); }); } + else { + // custom header + $rootScope.appVersion = NVR.getAppVersion(); + } + // At this stage, NVR.init is not called yet -- cgit v1.2.3