Browse Source

Merge pull request #41 from genabasov/0.10.9

Reject promise by iOS openDocument when a file is not opened
Travis Nuttall 6 years ago
parent
commit
33d55c0b6f
No account linked to committer's email address
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      ios/RNFetchBlob/RNFetchBlob.m

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

@@ -587,9 +587,12 @@ RCT_EXPORT_METHOD(openDocument:(NSString*)uri scheme:(NSString *)scheme resolver
587 587
 
588 588
     if(scheme == nil || [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) {
589 589
         dispatch_sync(dispatch_get_main_queue(), ^{
590
-            [documentController presentPreviewAnimated:YES];
590
+            if([documentController presentPreviewAnimated:YES]) {
591
+                resolve(@[[NSNull null]]);
592
+            } else {
593
+                reject(@"EINVAL", @"document is not supported", nil);
594
+            }
591 595
         });
592
-        resolve(@[[NSNull null]]);
593 596
     } else {
594 597
         reject(@"EINVAL", @"scheme is not supported", nil);
595 598
     }