Bladeren bron

Reject promise by iOS openDocument when a file is not opened

Gennady Basov 6 jaren geleden
bovenliggende
commit
c5de6f806b
1 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. 5
    2
      ios/RNFetchBlob/RNFetchBlob.m

+ 5
- 2
ios/RNFetchBlob/RNFetchBlob.m Bestand weergeven

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