Browse Source

Merge branch 'master' into 0.8.0

Ben Hsieh 8 years ago
parent
commit
89a73a5b4d
6 changed files with 17 additions and 8 deletions
  1. 6
    6
      README.md
  2. 1
    1
      package.json
  3. 2
    0
      src/README.md
  4. 1
    0
      src/android/build.gradle
  5. 1
    1
      src/package.json
  6. 6
    0
      src/scripts/prelink.js

+ 6
- 6
README.md View File

@@ -1,4 +1,4 @@
1
-# react-native-fetch-blob [![release](https://img.shields.io/github/release/wkh237/react-native-fetch-blob.svg?maxAge=86400&style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) [![npm](https://img.shields.io/npm/v/react-native-fetch-blob.svg?style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) ![](https://img.shields.io/badge/PR-Welcome-brightgreen.svg?style=flat-square) [![npm](https://img.shields.io/npm/l/express.svg?maxAge=2592000&style=flat-square)]()
1
+# react-native-fetch-blob [![release](https://img.shields.io/github/release/wkh237/react-native-fetch-blob.svg?maxAge=86400&style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) [![npm](https://img.shields.io/npm/v/react-native-fetch-blob.svg?style=flat-square)](https://www.npmjs.com/package/react-native-fetch-blob) ![](https://img.shields.io/badge/PR-Welcome-brightgreen.svg?style=flat-square) [![npm](https://img.shields.io/npm/l/react-native-fetch-blob.svg?maxAge=2592000&style=flat-square)]() ![](https://img.shields.io/badge/inpPogress-0.8.0-yellow.svg?style=flat-square)
2 2
 
3 3
 A project committed to make file acess and transfer easier and effiecient for React Native developers.
4 4
 
@@ -23,15 +23,13 @@ A project committed to make file acess and transfer easier and effiecient for Re
23 23
 
24 24
 ## About
25 25
 
26
-React Native does not support `Blob` object at this moment, which means if you're going to send/receive binary data via `fetch` API, that might not work as you expect. See [facebook/react-native#854](https://github.com/facebook/react-native/issues/854).
26
+This project was initially for solving the issue [facebook/react-native#854](https://github.com/facebook/react-native/issues/854), because React Native does not support `Blob` object and it will cause some problem when sending and receiving binary data. There's aleady [a PR ](https://github.com/facebook/react-native/pull/8324) merged into RN master branch which will probably solving the issue in the near future.
27 27
 
28
-For some use cases, you might get into trouble. For example, displaying an image that requires a specific field in headers (ex. "Authorization : Bearer ...") or body, so you can't just pass the image uri to `Image` component because that will probably returns a 401 response. Or you're going to upload binary data which generated from JS, the server will get an empry body due to [this issue](https://github.com/facebook/react-native/issues/854). With help of APIs provided by this module, you can send HTTP request with any headers, and decide how to handle the response/reqeust data without worry about if it is not supported by `fetch` API. The response data can be just simply converted into BASE64 string, or stored to a file directly so that you can read it by using file access APIs such as readFile, readStream.
29
-
30
-This module was designed to be a substitution of `Blob`, there's a set of APIs including basic file system CRUD method, and file stream reader/writer. Also it has a special `fetch` implementation that supports binary request/response body.
28
+Now, this project is committed to make file acess and transfer more easier and more effiecient for React Native developers. We've implemented lot of file access function which plays well with our network module. For example, it can upload and download data directly into/from file system, which is much more performant (especially for large ones) than converting data to BASE64 passing them around through React JS Bridge, also, file stream support so that you can read large file not causing OOM error.
31 29
 
32 30
 ## Backward Compatible
33 31
 
34
-All updates are `backward-compatible` generally you don't have to change existing code unless you're going to use new APIs. But we recommend pre `0.5.0` users consider upgrade the package to latest version, since we have introduced new APIs can either `upload` or `download` files simply using a file path. It's much more memory efficent in some use case. We've also introduced `fs` APIs for access files, and `file stream` API that helps you read/write files (especially for **large ones**), see [Examples](#user-content-recipes) bellow. This module implements native methods, supports both Android (uses same native library as offical RN fetch API [OkHttp](https://github.com/square/okhttp)) and IOS.
32
+All updates are `backward-compatible` generally you don't have to change existing code unless you're going to use new APIs. But it's recommended pre `0.5.0` users consider upgrade the package to latest version, since we have introduced new APIs can either `upload` or `download` files simply using a file path. It's much more memory efficent in some use case. We've also introduced `fs` APIs for access files, and `file stream` API that helps you read/write files (especially for **large ones**), see [Examples](#user-content-recipes) bellow. This module implements native methods, supports both Android (uses same native library as offical RN fetch API [OkHttp](https://github.com/square/okhttp)) and IOS.
35 33
 
36 34
 ## Installation
37 35
 
@@ -616,6 +614,8 @@ RNFetchBlob.config({
616 614
 
617 615
 | Version | |
618 616
 |---|---|
617
+| 0.7.4 | Fix app crash problem in version > 0.27 |
618
+| 0.7.3 | Fix OkHttp dependency issue in version < 0.29 |
619 619
 | 0.7.2 | Fix cancel request bug |
620 620
 | 0.7.1 | Fix #57 ios module could not compile on ios version <= 9.3 |
621 621
 | 0.7.0 | Add support of Android upload progress, and remove AsyncHttpClient dependency from Android native implementation. |

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "fetchblob",
3
-  "version": "0.7.2",
3
+  "version": "0.7.4",
4 4
   "private": true,
5 5
   "scripts": {
6 6
     "start": "node node_modules/react-native/local-cli/cli.js start",

+ 2
- 0
src/README.md View File

@@ -618,6 +618,8 @@ RNFetchBlob.config({
618 618
 
619 619
 | Version | |
620 620
 |---|---|
621
+| 0.7.4 | Fix app crash problem in version > 0.27 |
622
+| 0.7.3 | Fix OkHttp dependency issue in version < 0.29 |
621 623
 | 0.7.2 | Fix cancel request bug |
622 624
 | 0.7.1 | Fix #57 ios module could not compile on ios version <= 9.3 |
623 625
 | 0.7.0 | Add support of Android upload progress, and remove AsyncHttpClient dependency from Android native implementation. |

+ 1
- 0
src/android/build.gradle View File

@@ -34,4 +34,5 @@ android {
34 34
 
35 35
 dependencies {
36 36
     compile 'com.facebook.react:react-native:+'
37
+    //{RNFetchBlob_PRE_0.29_DEPDENDENCY}
37 38
 }

+ 1
- 1
src/package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-fetch-blob",
3
-  "version": "0.7.2",
3
+  "version": "0.7.4",
4 4
   "description": "A module provides upload, download, and files access API. Supports file stream read/write for process large files.",
5 5
   "main": "index.js",
6 6
   "scripts": {

+ 6
- 0
src/scripts/prelink.js View File

@@ -12,6 +12,7 @@ if (!hasNecessaryFile) {
12 12
 var package = JSON.parse(fs.readFileSync(PACKAGE_JSON));
13 13
 var APP_NAME = package.name;
14 14
 var APPLICATION_MAIN = process.cwd() + '/android/app/src/main/java/com/' + APP_NAME.toLocaleLowerCase() + '/MainApplication.java';
15
+var PACKAGE_GRADLE = process.cwd() + '/node_modules/react-native-fetch-blob/android/build.gradle'
15 16
 
16 17
 var VERSION = checkVersion();
17 18
 console.log('RNFetchBlob detected app version .. ' + VERSION);
@@ -28,11 +29,16 @@ if(VERSION >= 0.29) {
28 29
   }
29 30
   main = String(main).replace('new MainReactPackage()', 'new RNFetchBlobPackage(),\n           new MainReactPackage()');
30 31
   main = String(main).replace('import com.facebook.react.ReactApplication;', 'import com.facebook.react.ReactApplication;\nimport com.RNFetchBlob.RNFetchBlobPackage;')
32
+
31 33
   fs.writeFileSync(APPLICATION_MAIN, main);
32 34
   console.log('RNFetchBlob patching MainApplication.java .. ok')
33 35
 
34 36
 }
35 37
 
38
+if(VERSION < 0.27) {
39
+  console.log('You project version is '+ VERSION + 'which does not meet requirement of react-native-fetch-blob 7.0+, please upgrade your application template to react-native 0.27+, otherwise Android application will not working.')
40
+}
41
+
36 42
 // set file access permission for Android < 6.0
37 43
 fs.readFile(MANIFEST_PATH, function(err, data) {
38 44