Skip to content

Commit 061431d

Browse files
committed
1.0.0
1 parent feaaf87 commit 061431d

11 files changed

+73
-35
lines changed

CHANGELOG.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
## master ##
44

5-
## 1.0rc2 ##
5+
## 1.0.0 ##
6+
7+
### FIXED ###
8+
* Fixed issue with _chrisben:imgcache_ folder name (Meteor package) (thanks filozoom)
9+
10+
### IMPROVED ###
11+
* Improved documentation regarding Android and iOS (#148 thanks eekilli)
12+
* Some code improvements (thanks Lanayx)
13+
14+
## 1.0rc2 ##
615

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

18-
## 1.0rc1 ##
27+
## 1.0rc1 ##
1928

2029
### NEW ###
2130
* Added a wrapper for imgcache that supports Promises (qimgcache.js)

CORDOVA.md

+23
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,26 @@ If you only want to do tests you can allow access to all domains to avoid this k
7676
In order to avoid possible security issues, always limit the allowed domains list whenever possible.
7777

7878
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).
79+
80+
## Android
81+
82+
For Android, it has been reported in [#148](https://github.com/chrisben/imgcache.js/issues/148) that the following is also required for Android:
83+
84+
```xml
85+
<access origin="cdvfile://*" />
86+
```
87+
88+
If you use the whitelist plugin you probably have to add the following as well:
89+
90+
```xml
91+
<allow-intent href="cdvfile://*" />
92+
```
93+
94+
## iOS
95+
96+
To keep cached images persistent across app updates, add the following to your
97+
config.xml file:
98+
99+
```xml
100+
<preference name="iosPersistentFileLocation" value="Library" />
101+
```

KNOWN_ISSUES.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
* getCurrentSize() always returns 0 using Cordova Plugin File v1.0.0.
66
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.
77
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.
8+
9+
* Android users, check out the Android section of [CORDOVA.md](https://github.com/chrisben/imgcache.js/blob/master/CORDOVA.md) if
10+
you're having troubles.

LICENSE.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Apache License
22

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

55
*Version 2.0, January 2004*
66

@@ -30,15 +30,15 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
3030

3131
"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.
3232

33-
2. Grant of Copyright License.
33+
2. Grant of Copyright License.
3434

3535
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.
3636

37-
3. Grant of Patent License.
37+
3. Grant of Patent License.
3838

3939
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.
4040

41-
4. Redistribution.
41+
4. Redistribution.
4242

4343
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:
4444

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

5151
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.
5252

53-
5. Submission of Contributions.
53+
5. Submission of Contributions.
5454

5555
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.
5656

57-
6. Trademarks.
57+
6. Trademarks.
5858

5959
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.
6060

61-
7. Disclaimer of Warranty.
61+
7. Disclaimer of Warranty.
6262

6363
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.
6464

65-
8. Limitation of Liability.
65+
8. Limitation of Liability.
6666

6767
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.
6868

69-
9. Accepting Warranty or Additional Liability.
69+
9. Accepting Warranty or Additional Liability.
7070

7171
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.
7272

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Wrappers for AngularJS:
257257

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

262262
Apache License - see LICENSE.md
263263

bower.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"name": "imgcache.js",
3-
"version": "1.0rc2",
3+
"version": "1.0.0",
44
"homepage": "https://github.com/chrisben/imgcache.js",
55
"authors": [
66
{
7-
"name": "Christophe Benoit",
8-
"homepage": "http://www.wobis.fr"
7+
"name": "Christophe Benoit"
98
}
109
],
1110
"repository": {

config.xml

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010

1111
<description>Test application</description>
1212

13-
<author href="http://www.wobis.fr"
14-
email="christophe@wobis.fr">
15-
Christophe Benoit
16-
</author>
13+
<author>ImgCache</author>
1714

1815
<feature name="http://api.phonegap.com/1.0/file"/>
1916
<feature name="http://api.phonegap.com/1.0/device"/>
@@ -22,7 +19,7 @@
2219
<gap:plugin name="org.apache.cordova.file" />
2320
<gap:plugin name="org.apache.cordova.device" />
2421
<gap:plugin name="org.apache.cordova.file-transfer" />
25-
22+
2623
<feature name="Device">
2724
<param name="ios-package" value="CDVDevice" />
2825
<param name="android-package" value="org.apache.cordova.device.Device" />
@@ -35,11 +32,13 @@
3532
<param name="ios-package" value="CDVFileTransfer" />
3633
<param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
3734
</feature>
38-
35+
3936
<preference name="orientation" value="default" />
4037
<preference name="target-device" value="universal" />
4138
<preference name="fullscreen" value="true" />
4239
<preference name="phonegap-version" value="3.3.0" />
4340

4441
<access origin="*" />
42+
<!-- <access origin="cdvfile://*" /> -->
43+
4544
</widget>

index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
testableMethods.push(m);
3232
}
3333
}
34-
var testedMethods = {};
34+
var testedMethods = {};
3535

3636
ImgCache.options.debug = true;
3737
ImgCache.overridables.log = logger;
@@ -61,7 +61,8 @@
6161
return;
6262
}
6363
var regexp = /\((.+)\)/;
64-
return regexp.exec(backgroundImageProperty)[1];
64+
var img_src = regexp.exec(backgroundImageProperty)[1];
65+
return img_src.replace(/(['"])/g, '');
6566
};
6667

6768
var getAppropriateElement = function (element) {
@@ -285,7 +286,7 @@
285286
var run_next_test_suite = function () {
286287
if (cur_test_suite === test_suites_options.length + 1) {
287288
// reset non-option
288-
ImgCache.jQuery = window.jQuery;
289+
ImgCache.jQuery = !!window.jQuery;
289290
logger('END OF TESTS', LOG_LEVEL_INFO);
290291
return;
291292
}

js/imgcache.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*! imgcache.js
2-
Copyright 2012-2015 Christophe BENOIT
2+
Copyright 2012-2016 Christophe BENOIT
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818
/*global console,LocalFileSystem,device,FileTransfer,define,module*/
1919

2020
var ImgCache = {
21-
version: '1.0rc2',
21+
version: '1.0.0',
2222
// options to override before using the library (but after loading this script!)
2323
options: {
2424
debug: false, /* call the log method ? */
@@ -66,6 +66,9 @@ var ImgCache = {
6666
if (ImgCache.options.skipURIencoding) {
6767
return uri;
6868
} else {
69+
if (uri.length >= 2 && uri[0] === '"' && uri[uri.length - 1] === '"') {
70+
uri = uri.substr(1, uri.length - 2);
71+
}
6972
var encodedURI = encodeURI(uri);
7073
/*
7174
TODO: The following bit of code will have to be checked first (#30)
@@ -472,8 +475,7 @@ var ImgCache = {
472475
}
473476
var regexp = /\((.+)\)/;
474477
var img_src = regexp.exec(backgroundImageProperty)[1];
475-
476-
return img_src.replace(/(['"])/g, "");
478+
return img_src.replace(/(['"])/g, '');
477479
};
478480

479481
Private.loadCachedFile = function ($element, img_src, set_path_callback, success_callback, error_callback) {
@@ -580,12 +582,12 @@ var ImgCache = {
580582
ImgCache.overridables.log('Failed to initialise LocalFileSystem ' + error.code, LOG_LEVEL_ERROR);
581583
if (error_callback) { error_callback(); }
582584
};
583-
if (Helpers.isCordova()) {
585+
if (Helpers.isCordova() && window.requestFileSystem) {
584586
// PHONEGAP
585587
window.requestFileSystem(Helpers.getCordovaStorageType(ImgCache.options.usePersistentCache), 0, _gotFS, _fail);
586588
} else {
587589
//CHROME
588-
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
590+
var savedFS = window.requestFileSystem || window.webkitRequestFileSystem;
589591
window.storageInfo = window.storageInfo || (ImgCache.options.usePersistentCache ? navigator.webkitPersistentStorage : navigator.webkitTemporaryStorage);
590592
if (!window.storageInfo) {
591593
ImgCache.overridables.log('Your browser does not support the html5 File API', LOG_LEVEL_WARNING);
@@ -599,7 +601,7 @@ var ImgCache = {
599601
function () {
600602
/* success*/
601603
var persistence = (ImgCache.options.usePersistentCache ? window.storageInfo.PERSISTENT : window.storageInfo.TEMPORARY);
602-
window.requestFileSystem(persistence, quota_size, _gotFS, _fail);
604+
savedFS(persistence, quota_size, _gotFS, _fail);
603605
},
604606
function (error) {
605607
/* error*/
@@ -666,7 +668,9 @@ var ImgCache = {
666668
);
667669
}
668670

669-
if (success_callback) { success_callback(); }
671+
if (success_callback) {
672+
success_callback(entry.toURL());
673+
}
670674
},
671675
function (error) {
672676
if (error.source) { ImgCache.overridables.log('Download error source: ' + error.source, LOG_LEVEL_ERROR); }

js/qimgcache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ImgCache.js wrapper using Q (https://github.com/kriskowal/q) to use promises.
44
This version takes care of calling the init method for you.
55
6-
Copyright 2014-2015 Christophe BENOIT
6+
Copyright 2014-2016 Christophe BENOIT
77
88
Licensed under the Apache License, Version 2.0 (the "License");
99
you may not use this file except in compliance with the License.

package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package.describe({
22
summary: "JS library that stores images locally for offline apps using PhoneGap/Cordova or browsers supporting the new html5 File API",
3-
version: "1.0rc2",
3+
version: "1.0.0",
44
git: "https://github.com/chrisben/imgcache.js"
55
});
66

0 commit comments

Comments
 (0)