downloadFile missing code

This commit is contained in:
Chris Dell 2015-11-23 17:08:52 +00:00
parent d92782b7d9
commit 97f6eba9c1
2 changed files with 7 additions and 3 deletions

View File

@ -170,6 +170,10 @@ var RNFS = {
.catch(convertError);
},
stopDownload(jobId) {
RNFSManager.stopDownload(jobId);
},
MainBundlePath: RNFSManager.MainBundlePath,
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath

View File

@ -165,7 +165,7 @@ RCT_EXPORT_METHOD(downloadFile:(NSString *)urlStr
@"bytesWritten": bytesWritten}]);
};
params.errorCallback = ^(NSError* error) {
params.errorCallback = ^(NSError* error) {
return callback([self makeErrorPayload:error]);
};
@ -183,7 +183,7 @@ RCT_EXPORT_METHOD(downloadFile:(NSString *)urlStr
@"bytesWritten": bytesWritten}];
};
if (self.downloaders) self.downloaders = [NSMutableDictionary alloc];
if (!self.downloaders) self.downloaders = [[NSMutableDictionary alloc] init];
Downloader* downloader = [Downloader alloc];
@ -192,7 +192,7 @@ RCT_EXPORT_METHOD(downloadFile:(NSString *)urlStr
[self.downloaders setValue:downloader forKey:[jobId stringValue]];
}
RCT_EXPORT_METHOD(stopDownload:(NSNumber *)jobId)
RCT_EXPORT_METHOD(stopDownload:(nonnull NSNumber *)jobId)
{
Downloader* downloader = [self.downloaders objectForKey:[jobId stringValue]];