Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisben committed Jan 24, 2016
1 parent feaaf87 commit 061431d
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 35 deletions.
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

## master ##

## 1.0rc2 ##
## 1.0.0 ##

### FIXED ###
* Fixed issue with _chrisben:imgcache_ folder name (Meteor package) (thanks filozoom)

### IMPROVED ###
* Improved documentation regarding Android and iOS (#148 thanks eekilli)
* Some code improvements (thanks Lanayx)

## 1.0rc2 ##

### FIXED ###
* Fix for Windows Phone 8.1 (#132 thanks badpenguin and Sturgelose)
Expand All @@ -13,9 +22,9 @@
* Don't set iCloud-related metadata outside iOS (#112)
* Added note about bower & npm in the README (#104)
* Avoid double forward slashes in cached files paths (#108)
* Added Meteor integration (#125 thanks @caio-ribeiro-pereira)
* Added Meteor integration (#125 thanks caio-ribeiro-pereira)

## 1.0rc1 ##
## 1.0rc1 ##

### NEW ###
* Added a wrapper for imgcache that supports Promises (qimgcache.js)
Expand Down
23 changes: 23 additions & 0 deletions CORDOVA.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,26 @@ If you only want to do tests you can allow access to all domains to avoid this k
In order to avoid possible security issues, always limit the allowed domains list whenever possible.

For more information about this access origin configuration see [Whitelist Guide](http://docs.phonegap.com/en/edge/guide_appdev_whitelist_index.md.html#Whitelist%20Guide).

## Android

For Android, it has been reported in [#148](https://github.com/chrisben/imgcache.js/issues/148) that the following is also required for Android:

```xml
<access origin="cdvfile://*" />
```

If you use the whitelist plugin you probably have to add the following as well:

```xml
<allow-intent href="cdvfile://*" />
```

## iOS

To keep cached images persistent across app updates, add the following to your
config.xml file:

```xml
<preference name="iosPersistentFileLocation" value="Library" />
```
3 changes: 3 additions & 0 deletions KNOWN_ISSUES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
* getCurrentSize() always returns 0 using Cordova Plugin File v1.0.0.
The problem is that the Metadata interface of a File entry does not have a *size* property thus it does not match the html5 specifications.
Looking at the code for this plugin, this should have been [fixed](https://github.com/apache/cordova-plugin-file/commit/9ac8e477c0fda6aed3878a4cf165257f00e1bf83) in v1.0.1 but unit test still fail on iOS.

* Android users, check out the Android section of [CORDOVA.md](https://github.com/chrisben/imgcache.js/blob/master/CORDOVA.md) if
you're having troubles.
18 changes: 9 additions & 9 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Apache License

Copyright 2012-2015 (c) Christophe BENOIT - [Wobis](http://www.wobis.fr)
Copyright 2012-2016 (c) Christophe BENOIT

*Version 2.0, January 2004*

Expand Down Expand Up @@ -30,15 +30,15 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.

2. Grant of Copyright License.
2. Grant of Copyright License.

Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.

3. Grant of Patent License.
3. Grant of Patent License.

Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.

4. Redistribution.
4. Redistribution.

You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

Expand All @@ -50,23 +50,23 @@ You must retain, in the Source form of any Derivative Works that You distribute,

If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.

5. Submission of Contributions.
5. Submission of Contributions.

Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

6. Trademarks.
6. Trademarks.

This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty.
7. Disclaimer of Warranty.

Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

8. Limitation of Liability.
8. Limitation of Liability.

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability.
9. Accepting Warranty or Additional Liability.

While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Wrappers for AngularJS:

License
-------
Copyright 2012-2015 (c) Christophe BENOIT - [Wobis](http://www.wobis.fr)
Copyright 2012-2016 (c) Christophe BENOIT

Apache License - see LICENSE.md

Expand Down
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "imgcache.js",
"version": "1.0rc2",
"version": "1.0.0",
"homepage": "https://github.com/chrisben/imgcache.js",
"authors": [
{
"name": "Christophe Benoit",
"homepage": "http://www.wobis.fr"
"name": "Christophe Benoit"
}
],
"repository": {
Expand Down
11 changes: 5 additions & 6 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

<description>Test application</description>

<author href="http://www.wobis.fr"
email="christophe@wobis.fr">
Christophe Benoit
</author>
<author>ImgCache</author>

<feature name="http://api.phonegap.com/1.0/file"/>
<feature name="http://api.phonegap.com/1.0/device"/>
Expand All @@ -22,7 +19,7 @@
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.file-transfer" />

<feature name="Device">
<param name="ios-package" value="CDVDevice" />
<param name="android-package" value="org.apache.cordova.device.Device" />
Expand All @@ -35,11 +32,13 @@
<param name="ios-package" value="CDVFileTransfer" />
<param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
</feature>

<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="phonegap-version" value="3.3.0" />

<access origin="*" />
<!-- <access origin="cdvfile://*" /> -->

</widget>
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
testableMethods.push(m);
}
}
var testedMethods = {};
var testedMethods = {};

ImgCache.options.debug = true;
ImgCache.overridables.log = logger;
Expand Down Expand Up @@ -61,7 +61,8 @@
return;
}
var regexp = /\((.+)\)/;
return regexp.exec(backgroundImageProperty)[1];
var img_src = regexp.exec(backgroundImageProperty)[1];
return img_src.replace(/(['"])/g, '');
};

var getAppropriateElement = function (element) {
Expand Down Expand Up @@ -285,7 +286,7 @@
var run_next_test_suite = function () {
if (cur_test_suite === test_suites_options.length + 1) {
// reset non-option
ImgCache.jQuery = window.jQuery;
ImgCache.jQuery = !!window.jQuery;
logger('END OF TESTS', LOG_LEVEL_INFO);
return;
}
Expand Down
20 changes: 12 additions & 8 deletions js/imgcache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*! imgcache.js
Copyright 2012-2015 Christophe BENOIT
Copyright 2012-2016 Christophe BENOIT
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
/*global console,LocalFileSystem,device,FileTransfer,define,module*/

var ImgCache = {
version: '1.0rc2',
version: '1.0.0',
// options to override before using the library (but after loading this script!)
options: {
debug: false, /* call the log method ? */
Expand Down Expand Up @@ -66,6 +66,9 @@ var ImgCache = {
if (ImgCache.options.skipURIencoding) {
return uri;
} else {
if (uri.length >= 2 && uri[0] === '"' && uri[uri.length - 1] === '"') {
uri = uri.substr(1, uri.length - 2);
}
var encodedURI = encodeURI(uri);
/*
TODO: The following bit of code will have to be checked first (#30)
Expand Down Expand Up @@ -472,8 +475,7 @@ var ImgCache = {
}
var regexp = /\((.+)\)/;
var img_src = regexp.exec(backgroundImageProperty)[1];

return img_src.replace(/(['"])/g, "");
return img_src.replace(/(['"])/g, '');
};

Private.loadCachedFile = function ($element, img_src, set_path_callback, success_callback, error_callback) {
Expand Down Expand Up @@ -580,12 +582,12 @@ var ImgCache = {
ImgCache.overridables.log('Failed to initialise LocalFileSystem ' + error.code, LOG_LEVEL_ERROR);
if (error_callback) { error_callback(); }
};
if (Helpers.isCordova()) {
if (Helpers.isCordova() && window.requestFileSystem) {
// PHONEGAP
window.requestFileSystem(Helpers.getCordovaStorageType(ImgCache.options.usePersistentCache), 0, _gotFS, _fail);
} else {
//CHROME
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
var savedFS = window.requestFileSystem || window.webkitRequestFileSystem;
window.storageInfo = window.storageInfo || (ImgCache.options.usePersistentCache ? navigator.webkitPersistentStorage : navigator.webkitTemporaryStorage);
if (!window.storageInfo) {
ImgCache.overridables.log('Your browser does not support the html5 File API', LOG_LEVEL_WARNING);
Expand All @@ -599,7 +601,7 @@ var ImgCache = {
function () {
/* success*/
var persistence = (ImgCache.options.usePersistentCache ? window.storageInfo.PERSISTENT : window.storageInfo.TEMPORARY);
window.requestFileSystem(persistence, quota_size, _gotFS, _fail);
savedFS(persistence, quota_size, _gotFS, _fail);
},
function (error) {
/* error*/
Expand Down Expand Up @@ -666,7 +668,9 @@ var ImgCache = {
);
}

if (success_callback) { success_callback(); }
if (success_callback) {
success_callback(entry.toURL());
}
},
function (error) {
if (error.source) { ImgCache.overridables.log('Download error source: ' + error.source, LOG_LEVEL_ERROR); }
Expand Down
2 changes: 1 addition & 1 deletion js/qimgcache.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ImgCache.js wrapper using Q (https://github.com/kriskowal/q) to use promises.
This version takes care of calling the init method for you.
Copyright 2014-2015 Christophe BENOIT
Copyright 2014-2016 Christophe BENOIT
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
summary: "JS library that stores images locally for offline apps using PhoneGap/Cordova or browsers supporting the new html5 File API",
version: "1.0rc2",
version: "1.0.0",
git: "https://github.com/chrisben/imgcache.js"
});

Expand Down

0 comments on commit 061431d

Please sign in to comment.