Browse Source

Change confusing API naming #158

Ben Hsieh 8 years ago
parent
commit
99648e3435
2 changed files with 6 additions and 6 deletions
  1. 4
    4
      src/ios.js
  2. 2
    2
      src/ios/RNFetchBlob/RNFetchBlob.m

+ 4
- 4
src/ios.js View File

@@ -18,9 +18,9 @@ const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
18 18
  * @param  {string} scheme URI scheme that needs to support, optional
19 19
  * @return {Promise}
20 20
  */
21
-function openDocument(path:string, scheme:string) {
21
+function previewDocument(path:string, scheme:string) {
22 22
   if(Platform.OS === 'ios')
23
-    return RNFetchBlob.openDocument('file://' + path, scheme)
23
+    return RNFetchBlob.previewDocument('file://' + path, scheme)
24 24
   else
25 25
     return Promise.reject('RNFetchBlob.openDocument only supports IOS.')
26 26
 }
@@ -31,9 +31,9 @@ function openDocument(path:string, scheme:string) {
31 31
  * @param  {string} scheme URI scheme that needs to support, optional
32 32
  * @return {Promise}
33 33
  */
34
-function previewDocument(path:string, scheme:string) {
34
+function openDocument(path:string, scheme:string) {
35 35
   if(Platform.OS === 'ios')
36
-    return RNFetchBlob.previewDocument('file://' + path, scheme)
36
+    return RNFetchBlob.openDocument('file://' + path, scheme)
37 37
   else
38 38
     return Promise.reject('RNFetchBlob.previewDocument only supports IOS.')
39 39
 }

+ 2
- 2
src/ios/RNFetchBlob/RNFetchBlob.m View File

@@ -438,7 +438,7 @@ RCT_EXPORT_METHOD(slice:(NSString *)src dest:(NSString *)dest start:(nonnull NSN
438 438
     [RNFetchBlobFS slice:src dest:dest start:start end:end encode:@"" resolver:resolve rejecter:reject];
439 439
 })
440 440
 
441
-RCT_EXPORT_METHOD(openDocument:(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 443
     
444 444
     NSURL * url = [[NSURL alloc] initWithString:uri];
@@ -455,7 +455,7 @@ RCT_EXPORT_METHOD(openDocument:(NSString*)uri scheme:(NSString *)scheme resolver
455 455
 
456 456
 # pragma mark - open file with UIDocumentInteractionController and delegate
457 457
 
458
-RCT_EXPORT_METHOD(previewDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
458
+RCT_EXPORT_METHOD(openDocument:(NSString*)uri scheme:(NSString *)scheme resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject
459 459
 {
460 460
     
461 461
     NSURL * url = [[NSURL alloc] initWithString:uri];