瀏覽代碼

Merge pull request #209 from openmynet/patch-1

Patch 1
wkh237 8 年之前
父節點
當前提交
327c8cc947
共有 4 個檔案被更改,包括 14 行新增11 行删除
  1. 2
    1
      .github/ISSUE_TEMPLATE
  2. 5
    5
      README.md
  3. 1
    1
      package.json
  4. 6
    4
      src/ios/RNFetchBlob/RNFetchBlob.m

+ 2
- 1
.github/ISSUE_TEMPLATE 查看文件

@@ -1,4 +1,5 @@
1
-Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. You may want to take a look on that page or find issues tagged "trouble shooting" :p 
1
+Hi ! Thank you for reporting an issue, but we would like to remind you, we have a trouble shooting page in our wiki. 
2
+You may want to take a look on that page or find issues tagged "trouble shooting" :p 
2 3
 
3 4
 * please provide the version of installed library and RN project.
4 5
 * a sample code snippet/repository is very helpful to spotting the problem.

+ 5
- 5
README.md 查看文件

@@ -4,9 +4,9 @@
4 4
 
5 5
 A project committed to make file acess and data transfer easier, efficient for React Native developers.
6 6
 
7
-> If you're going to use github repo as npm dependency please use the [archive repository](https://github.com/wkh237/react-native-fetch-blob-package/releases/tag/v0.9.6).
7
+> If you're going to use github repo as npm dependency please visit the [archive repository](https://github.com/wkh237/react-native-fetch-blob-package/releases/tag/v0.9.6).
8 8
 
9
-> If you're using this library as Firebase Storage solution, please upgrade to 0.9.6 since XMLHttpRequest polyfill has way better compatibility than previous versions.
9
+> For Firebase Storage solution, please upgrade to 0.10.1-beta.1 for best compatibility.
10 10
 
11 11
 ## Features
12 12
 - Transfer data directly from/to storage without BASE64 bridging
@@ -14,7 +14,7 @@ A project committed to make file acess and data transfer easier, efficient for R
14 14
 - Native-to-native file manipulation API, reduce JS bridging performance loss
15 15
 - File stream support for dealing with large file
16 16
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
17
-- JSON stream supported base on [Oboe.js@jimhigson](https://github.com/jimhigson/oboe.js/)
17
+- JSON stream supported base on [Oboe.js](https://github.com/jimhigson/oboe.js/) @jimhigson
18 18
 
19 19
 ## TOC
20 20
 * [About](#user-content-about)
@@ -608,10 +608,10 @@ When calling `readStream` method, you have to `open` the stream, and start to re
608 608
 ```js
609 609
 let data = ''
610 610
 RNFetchBlob.fs.readStream(
611
-    // encoding, should be one of `base64`, `utf8`, `ascii`
612
-    'base64',
613 611
     // file path
614 612
     PATH_TO_THE_FILE,
613
+    // encoding, should be one of `base64`, `utf8`, `ascii`
614
+    'base64',
615 615
     // (optional) buffer size, default to 4096 (4095 for BASE64 encoded data)
616 616
     // when reading file in BASE64 encoding, buffer size must be multiples of 3.
617 617
     4095)

+ 1
- 1
package.json 查看文件

@@ -6,7 +6,7 @@
6 6
   "scripts": {
7 7
     "start": "node node_modules/react-native/local-cli/cli.js start",
8 8
     "update-info": "sh scripts/contributors.sh",
9
-    "test": "sh ./scrips/test.sh"
9
+    "test": "sh ./scripts/test.sh"
10 10
   },
11 11
   "devDependencies": {
12 12
     "body-parser": "^1.15.0",

+ 6
- 4
src/ios/RNFetchBlob/RNFetchBlob.m 查看文件

@@ -440,8 +440,9 @@ RCT_EXPORT_METHOD(slice:(NSString *)src dest:(NSString *)dest start:(nonnull NSN
440 440
 
441 441
 RCT_EXPORT_METHOD(previewDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
442 442
 {
443
-    
444
-    NSURL * url = [[NSURL alloc] initWithString:uri];
443
+    NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
444
+    NSURL * url = [[NSURL alloc] initWithString:utf8uri];
445
+    // NSURL * url = [[NSURL alloc] initWithString:uri];
445 446
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
446 447
     UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
447 448
     documentController.delegate = self;
@@ -459,8 +460,9 @@ RCT_EXPORT_METHOD(previewDocument:(NSString*)uri scheme:(NSString *)scheme resol
459 460
 
460 461
 RCT_EXPORT_METHOD(openDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
461 462
 {
462
-    
463
-    NSURL * url = [[NSURL alloc] initWithString:uri];
463
+    NSString * utf8uri = [uri stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
464
+    NSURL * url = [[NSURL alloc] initWithString:utf8uri];
465
+    // NSURL * url = [[NSURL alloc] initWithString:uri];
464 466
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
465 467
     documentController.delegate = self;
466 468