From a29f9a676a6ea3bad56ede05cd1a1c82ffbbe8e9 Mon Sep 17 00:00:00 2001 From: pliablepixels Date: Sun, 10 Apr 2016 10:47:35 -0400 Subject: #219 - everything upgraded Former-commit-id: 15f58d10df83feda8199a1b904433e625ef36b44 --- www/lib/filelogger/dist/filelogger.js | 33 ++++++++++++++++++++++++++++--- www/lib/filelogger/dist/filelogger.min.js | 4 ++-- 2 files changed, 32 insertions(+), 5 deletions(-) (limited to 'www/lib/filelogger/dist') diff --git a/www/lib/filelogger/dist/filelogger.js b/www/lib/filelogger/dist/filelogger.js index fa5f2625..8a90ab5c 100644 --- a/www/lib/filelogger/dist/filelogger.js +++ b/www/lib/filelogger/dist/filelogger.js @@ -1,10 +1,11 @@ /*! * fileLogger - * Copyright 2015 Peter Bakondy https://github.com/pbakondy + * Copyright 2016 Peter Bakondy https://github.com/pbakondy * See LICENSE in this repository for license information */ (function(){ /* global angular, console, cordova */ +/* eslint no-console:0 */ // install : cordova plugin add cordova-plugin-file // date format: https://docs.angularjs.org/api/ng/filter/date @@ -57,7 +58,9 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) try { // avoid "TypeError: Converting circular structure to JSON" text = JSON.stringify(messages[i]); - } catch(e) {} + } catch(e) { + // do nothing + } message.push(text); } else if (angular.isObject(messages[i])) { @@ -65,7 +68,9 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) try { // avoid "TypeError: Converting circular structure to JSON" text = JSON.stringify(messages[i]); - } catch(e) {} + } catch(e) { + // do nothing + } message.push(text); } else { @@ -167,6 +172,11 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) } else { + if (!$window.cordova || !$window.cordova.file || !$window.cordova.file.dataDirectory) { + q.reject('cordova.file.dataDirectory is not available'); + return q.promise; + } + $cordovaFile.checkFile(cordova.file.dataDirectory, storageFilename).then( function() { // writeExistingFile(path, fileName, text) @@ -204,6 +214,12 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) if (isBrowser()) { q.resolve($window.localStorage[storageFilename]); } else { + + if (!$window.cordova || !$window.cordova.file || !$window.cordova.file.dataDirectory) { + q.reject('cordova.file.dataDirectory is not available'); + return q.promise; + } + $cordovaFile.readAsText(cordova.file.dataDirectory, storageFilename).then( function(result) { q.resolve(result); @@ -225,6 +241,12 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) $window.localStorage.removeItem(storageFilename); q.resolve(); } else { + + if (!$window.cordova || !$window.cordova.file || !$window.cordova.file.dataDirectory) { + q.reject('cordova.file.dataDirectory is not available'); + return q.promise; + } + $cordovaFile.removeFile(cordova.file.dataDirectory, storageFilename).then( function(result) { q.resolve(result); @@ -276,6 +298,11 @@ angular.module('fileLogger', ['ngCordova.plugins.file']) } else { + if (!$window.cordova || !$window.cordova.file || !$window.cordova.file.dataDirectory) { + q.reject('cordova.file.dataDirectory is not available'); + return q.promise; + } + $cordovaFile.checkFile(cordova.file.dataDirectory, storageFilename).then(function(fileEntry) { fileEntry.file(q.resolve, q.reject); }, q.reject); diff --git a/www/lib/filelogger/dist/filelogger.min.js b/www/lib/filelogger/dist/filelogger.min.js index 4fd8ec79..de02b863 100644 --- a/www/lib/filelogger/dist/filelogger.min.js +++ b/www/lib/filelogger/dist/filelogger.min.js @@ -1,6 +1,6 @@ /*! * fileLogger - * Copyright 2015 Peter Bakondy https://github.com/pbakondy + * Copyright 2016 Peter Bakondy https://github.com/pbakondy * See LICENSE in this repository for license information */ -!function(){angular.module("fileLogger",["ngCordova.plugins.file"]).factory("$fileLogger",["$q","$window","$cordovaFile","$timeout","$filter",function(e,o,n,r,t){"use strict";function a(){return!o.cordova&&!o.PhoneGap&&!o.phonegap}function l(e){angular.isString(e)?(e=e.toUpperCase(),-1===O.indexOf(e)&&(e="INFO")):e="INFO";for(var o,n=new Date,r=m?t("date")(n,m,F):n.toJSON(),l=Array.prototype.slice.call(arguments,1),c=[r,e],s=0;s0?(R=e,!0):!1}function g(e,o){if(!angular.isUndefined(e)&&!angular.isString(e))throw new TypeError("format parameter must be a string or undefined");if(!angular.isUndefined(o)&&!angular.isString(o))throw new TypeError("timezone parameter must be a string or undefined");m=e,F=o}function p(){var r=e.defer();return a()?r.resolve({name:R,localURL:"localStorage://localhost/"+R,type:"text/plain",size:o.localStorage[R]?o.localStorage[R].length:0}):n.checkFile(cordova.file.dataDirectory,R).then(function(e){e.file(r.resolve,r.reject)},r.reject),r.promise}function d(){var e=Array.prototype.slice.call(arguments,0);e.unshift("DEBUG"),l.apply(void 0,e)}function y(){var e=Array.prototype.slice.call(arguments,0);e.unshift("INFO"),l.apply(void 0,e)}function v(){var e=Array.prototype.slice.call(arguments,0);e.unshift("WARN"),l.apply(void 0,e)}function h(){var e=Array.prototype.slice.call(arguments,0);e.unshift("ERROR"),l.apply(void 0,e)}var m,F,S=[],b=!1,O=["DEBUG","INFO","WARN","ERROR"],R="messages.log";return{log:l,getLogfile:s,deleteLogfile:u,setStorageFilename:f,setTimestampFormat:g,checkFile:p,debug:d,info:y,warn:v,error:h}}])}(); \ No newline at end of file +!function(){angular.module("fileLogger",["ngCordova.plugins.file"]).factory("$fileLogger",["$q","$window","$cordovaFile","$timeout","$filter",function(e,o,r,a,n){"use strict";function t(){return!o.cordova&&!o.PhoneGap&&!o.phonegap}function i(e){angular.isString(e)?(e=e.toUpperCase(),-1===S.indexOf(e)&&(e="INFO")):e="INFO";for(var o,r=new Date,a=m?n("date")(r,m,b):r.toJSON(),i=Array.prototype.slice.call(arguments,1),c=[a,e],s=0;s0?(j=e,!0):!1}function g(e,o){if(!angular.isUndefined(e)&&!angular.isString(e))throw new TypeError("format parameter must be a string or undefined");if(!angular.isUndefined(o)&&!angular.isString(o))throw new TypeError("timezone parameter must be a string or undefined");m=e,b=o}function d(){var a=e.defer();if(t())a.resolve({name:j,localURL:"localStorage://localhost/"+j,type:"text/plain",size:o.localStorage[j]?o.localStorage[j].length:0});else{if(!o.cordova||!o.cordova.file||!o.cordova.file.dataDirectory)return a.reject("cordova.file.dataDirectory is not available"),a.promise;r.checkFile(cordova.file.dataDirectory,j).then(function(e){e.file(a.resolve,a.reject)},a.reject)}return a.promise}function p(){var e=Array.prototype.slice.call(arguments,0);e.unshift("DEBUG"),i.apply(void 0,e)}function v(){var e=Array.prototype.slice.call(arguments,0);e.unshift("INFO"),i.apply(void 0,e)}function y(){var e=Array.prototype.slice.call(arguments,0);e.unshift("WARN"),i.apply(void 0,e)}function h(){var e=Array.prototype.slice.call(arguments,0);e.unshift("ERROR"),i.apply(void 0,e)}var m,b,F=[],D=!1,S=["DEBUG","INFO","WARN","ERROR"],j="messages.log";return{log:i,getLogfile:s,deleteLogfile:f,setStorageFilename:u,setTimestampFormat:g,checkFile:d,debug:p,info:v,warn:y,error:h}}])}(); \ No newline at end of file -- cgit v1.2.3