Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Reject promise by iOS openDocument when a file is not opened #598

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
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