Browse Source

Merge pull request #209 from openmynet/patch-1

Patch 1
wkh237 8 years ago
parent
commit
327c8cc947
4 changed files with 14 additions and 11 deletions
  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 View File

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
 * please provide the version of installed library and RN project.
4
 * please provide the version of installed library and RN project.
4
 * a sample code snippet/repository is very helpful to spotting the problem.
5
 * a sample code snippet/repository is very helpful to spotting the problem.

+ 5
- 5
README.md View File

4
 
4
 
5
 A project committed to make file acess and data transfer easier, efficient for React Native developers.
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
 ## Features
11
 ## Features
12
 - Transfer data directly from/to storage without BASE64 bridging
12
 - Transfer data directly from/to storage without BASE64 bridging
14
 - Native-to-native file manipulation API, reduce JS bridging performance loss
14
 - Native-to-native file manipulation API, reduce JS bridging performance loss
15
 - File stream support for dealing with large file
15
 - File stream support for dealing with large file
16
 - Blob, File, XMLHttpRequest polyfills that make browser-based library available in RN (experimental)
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
 ## TOC
19
 ## TOC
20
 * [About](#user-content-about)
20
 * [About](#user-content-about)
608
 ```js
608
 ```js
609
 let data = ''
609
 let data = ''
610
 RNFetchBlob.fs.readStream(
610
 RNFetchBlob.fs.readStream(
611
-    // encoding, should be one of `base64`, `utf8`, `ascii`
612
-    'base64',
613
     // file path
611
     // file path
614
     PATH_TO_THE_FILE,
612
     PATH_TO_THE_FILE,
613
+    // encoding, should be one of `base64`, `utf8`, `ascii`
614
+    'base64',
615
     // (optional) buffer size, default to 4096 (4095 for BASE64 encoded data)
615
     // (optional) buffer size, default to 4096 (4095 for BASE64 encoded data)
616
     // when reading file in BASE64 encoding, buffer size must be multiples of 3.
616
     // when reading file in BASE64 encoding, buffer size must be multiples of 3.
617
     4095)
617
     4095)

+ 1
- 1
package.json View File

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

+ 6
- 4
src/ios/RNFetchBlob/RNFetchBlob.m View File

440
 
440
 
441
 RCT_EXPORT_METHOD(previewDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
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
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
446
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
446
     UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
447
     UIViewController *rootCtrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
447
     documentController.delegate = self;
448
     documentController.delegate = self;
459
 
460
 
460
 RCT_EXPORT_METHOD(openDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
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
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
466
     documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
465
     documentController.delegate = self;
467
     documentController.delegate = self;
466
     
468