mirror of
https://github.com/status-im/react-native-fs.git
synced 2025-02-28 23:10:29 +00:00
downloadFile missing code
This commit is contained in:
parent
d92782b7d9
commit
97f6eba9c1
@ -170,6 +170,10 @@ var RNFS = {
|
||||
.catch(convertError);
|
||||
},
|
||||
|
||||
stopDownload(jobId) {
|
||||
RNFSManager.stopDownload(jobId);
|
||||
},
|
||||
|
||||
MainBundlePath: RNFSManager.MainBundlePath,
|
||||
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
||||
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath
|
||||
|
@ -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]];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user