Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reject promise by iOS openDocument when a file is not opened
openDocument method may be unable to open unsupported files. In this case it's better to reject returning promise.
  • Loading branch information
gbasov authored Nov 16, 2017
commit f46baa8cf29a38da53d18ad5fa25b7e0ff8162ad
7 changes: 5 additions & 2 deletions ios/RNFetchBlob/RNFetchBlob.m
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,12 @@ - (NSDictionary *)constantsToExport

if(scheme == nil || [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) {
dispatch_sync(dispatch_get_main_queue(), ^{
[documentController presentPreviewAnimated:YES];
if([documentController presentPreviewAnimated:YES]) {
resolve(@[[NSNull null]]);
} else {
reject(@"RNFetchBlob could not open document", @"document is not supported", nil);
}
});
resolve(@[[NSNull null]]);
} else {
reject(@"RNFetchBlob could not open document", @"scheme is not supported", nil);
}
Expand Down