Explorar el Código

Merge branch '0.9.0' of github.com:wkh237/react-native-fetch-blob into 0.9.0

Ben Hsieh hace 8 años
padre
commit
cda9a6f48d
Se han modificado 1 ficheros con 36 adiciones y 2 borrados
  1. 36
    2
      README.md

+ 36
- 2
README.md Ver fichero

@@ -9,6 +9,7 @@ A project committed to make file acess and data transfer easier, effiecient for
9 9
 - File stream support for dealing with large file
10 10
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
11 11
 
12
+
12 13
 ## TOC
13 14
 * [About](#user-content-about)
14 15
 * [Installation](#user-content-installation)
@@ -38,6 +39,7 @@ This project was initially for solving the issue [facebook/react-native#854](htt
38 39
 
39 40
 In `0.8.0` we introduced experimential Web API polyfills that make it possible to use browser-based libraries in React Native, for example, [FireBase JS SDK](https://github.com/wkh237/rn-firebase-storage-upload-sample)
40 41
 
42
+
41 43
 ## Installation
42 44
 
43 45
 Install package from npm
@@ -493,6 +495,38 @@ RNFetchBlob.config({
493 495
 .then(...)
494 496
 ```
495 497
 
498
+**Open Downloaded File with Intent**
499
+
500
+This is a new feature added in `0.9.0`, if you're going to open a file path using official [Linking](https://facebook.github.io/react-native/docs/linking.html) API that might not work as expected, also, if you're going to install an APK in `Downloads` app, that will not work too. As an alternative, you can try `actionViewIntent` API, which will send an ACTION_VIEW intent for you which uses the given `MIME` type.
501
+
502
+Download and install an APK programatically
503
+
504
+```js
505
+
506
+const android = RNFetchBlob.android
507
+
508
+RNFetchBlob.config({
509
+    addAndroidDownloads : {
510
+      useDownloadManager : true,
511
+      title : 'awesome.apk',
512
+      description : 'An APK that will be installed',
513
+      mime : 'application/vnd.android.package-archive',
514
+      mediaScannable : true,
515
+      notification : true,
516
+    }
517
+  })
518
+  .fetch('GET', `http://www.example.com/awesome.apk`)
519
+  .then((res) => {
520
+      android.actionViewIntent(res.path(), 'application/vnd.android.package-archive')
521
+  })
522
+```
523
+
524
+Or show an image in image viewer
525
+
526
+```js
527
+      android.actionViewIntent(PATH_OF_IMG, 'image/png')
528
+```
529
+
496 530
 ### File System
497 531
 
498 532
 #### File Access
@@ -645,7 +679,7 @@ RNFetchBlob.config({
645 679
 
646 680
 ### Web API Polyfills
647 681
 
648
-After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(work-in-progress)) that makes some browser-based library available in RN.
682
+After `0.8.0` we've made some [Web API polyfills](https://github.com/wkh237/react-native-fetch-blob/wiki/Web-API-Polyfills-(experimental)) that makes some browser-based library available in RN.
649 683
 
650 684
 - Blob
651 685
 - XMLHttpRequest (Use our implementation if you're going to use it with Blob)
@@ -676,7 +710,7 @@ If you're going to concatenate files, you don't have to read the data to JS cont
676 710
 
677 711
 | Version | |
678 712
 |---|---|
679
-| 0.8.2 | Fix Android RN 0.31 installation issue #78 |
713
+| 0.9.0 | Fix unicode response data format issue #73. Improve Android performance by using thread pool instead of async task. Add Fetch replacement #70. Add Android only API `actionViewIntent` to open file or install APK in app |
680 714
 | 0.8.1 | Remove Web API log and fix ios progress report function. |
681 715
 | 0.8.0 | Added Web API polyfills, support regular request, added timeout option. |
682 716
 | 0.7.5 | Fix installation script that make it compatible to react-native < 0.28 |