Kaynağa Gözat

Reject promise by iOS openDocument when a file is not opened

Gennady Basov 7 yıl önce
ebeveyn
işleme
c5de6f806b
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5
    2
      ios/RNFetchBlob/RNFetchBlob.m

+ 5
- 2
ios/RNFetchBlob/RNFetchBlob.m Dosyayı Görüntüle

588
 
588
 
589
     if(scheme == nil || [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) {
589
     if(scheme == nil || [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) {
590
         dispatch_sync(dispatch_get_main_queue(), ^{
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
     } else {
597
     } else {
595
         reject(@"EINVAL", @"scheme is not supported", nil);
598
         reject(@"EINVAL", @"scheme is not supported", nil);
596
     }
599
     }