diff options
Diffstat (limited to 'www/js/app.js')
| -rw-r--r-- | www/js/app.js | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/www/js/app.js b/www/js/app.js index 1b30dea7..34958cbc 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1,6 +1,6 @@ /* jshint -W041, -W093 */ /* jslint browser: true*/ -/* global cordova,StatusBar,angular,console,alert,PushNotification, moment ,ionic, URI,Packery, ConnectSDK, CryptoJS, ContactFindOptions, localforage,$, Connection, MobileAccessibility */ +/* 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 @@ -78,7 +78,7 @@ angular.module('zmApp', [ desktopUrl: "/zm", desktopApiUrl: "/api/zm", latestRelease: "https://api.github.com/repos/pliablepixels/zmNinja/releases/latest", - blogUrl: "http://pliablepixels.github.io/feed.json", + blogUrl: "https://medium.com/zmninja/latest?format=json", nphSwitchTimer: 3000, eventHistoryTimer: 5000, eventPlaybackQuery: 3000, @@ -94,7 +94,10 @@ angular.module('zmApp', [ monSingleImageQualityLowBW: 70, montageQualityLowBW: 50, eventMontageQualityLowBW: 50, - maxGifCount:70, + maxGifCount:60, + maxGifCount2:100, + maxGifWidth:800.0, + quantSample:15, }) @@ -543,6 +546,8 @@ angular.module('zmApp', [ 'request': function(config) { + if (!config) return config; + if (!config.url) return config; // NOTE ON TIMEOUTS: As of Oct 10 2016, it seems // the Http queue often gets messed up when there is a timeout @@ -696,11 +701,21 @@ angular.module('zmApp', [ }); NVRDataModel.log("Checking for news updates"); - $http.get(zm.blogUrl) - .success(function(data) + $http.get(zm.blogUrl, + {transformResponse: function(d,h) + { + var trunc = "])}while(1);</x>"; + d = d.substr(trunc.length); + return d; + } + }) + + .success(function(datastr) { + + var data = JSON.parse(datastr); $rootScope.newBlogPost = ""; - if (data.length <= 0) + if (data.payload.posts.length <= 0) { $rootScope.newBlogPost = ""; return; @@ -716,23 +731,19 @@ angular.module('zmApp', [ } var mLastDate = moment(lastDate); - var mItemDate = moment(data[0].date); + var mItemDate = moment(data.payload.posts[0].createdAt); if (mItemDate.diff(mLastDate) > 0) { - NVRDataModel.debug("New post dated " + data[0].date + " found"); - if (data[0].level == "critical") - { - $rootScope.newBlogPost = "(new post)"; - } - else - { - NVRDataModel.debug("Not showing a notification in menu as this is not critical"); - } + NVRDataModel.debug("New post dated " + mItemDate.format("YYYY-MM-DD HH:mm:ss") + " found"); + + $rootScope.newBlogPost = "(new post)"; + + } else { - NVRDataModel.debug("Latest post dated " + data[0].date + " but you read " + lastDate); + NVRDataModel.debug("Latest post dated " + mItemDate.format("YYYY-MM-DD HH:mm:ss") + " but you read " + lastDate); } }); @@ -845,8 +856,11 @@ angular.module('zmApp', [ function doLogin(str) { + var d = $q.defer(); + + NVRDataModel.processFastLogin() // coming here means login not needed, old login is valid .then(function(success) @@ -870,6 +884,13 @@ angular.module('zmApp', [ } + if ($rootScope.isDownloading) + { + NVRDataModel.log("Skipping login process as we are downloading..."); + d.resolve("success"); + return d.promise; + } + NVRDataModel.debug("Resetting zmCookie..."); $rootScope.zmCookie = ''; // first try to login, if it works, good @@ -1335,7 +1356,7 @@ angular.module('zmApp', [ $ionicPlatform.ready(function() { - + $rootScope.textScaleFactor = 1.0; $rootScope.db = null; @@ -1663,6 +1684,7 @@ angular.module('zmApp', [ document.addEventListener("resume", function() { NVRDataModel.log("App is resuming from background"); + $rootScope.isDownloading = false; var forceDelay = NVRDataModel.getLogin().resumeDelay; NVRDataModel.log(">>> Resume delayed for " + forceDelay + " ms, to wait for network stack..."); |
