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

Commit 28e4b33

Browse files
authored
Merge pull request #79 from jbrodriguez/master
Fix callback signature
2 parents 39a562a + af9a4a4 commit 28e4b33

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void run() {
165165
File file = new File(RNFetchBlobFS.getTmpPath(RNFetchBlob.RCTContext, cacheKey) + ext);
166166

167167
if (file.exists()) {
168-
callback.invoke(null, file.getAbsolutePath());
168+
callback.invoke(null, null, file.getAbsolutePath());
169169
return;
170170
}
171171
}

src/ios/RNFetchBlobNetwork.m

+9-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
133133

134134
// the session trust any SSL certification
135135

136-
136+
137137
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
138138
if([options valueForKey:@"timeout"] != nil)
139139
{
@@ -153,7 +153,7 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
153153

154154
destPath = [RNFetchBlobFS getTempPath:cacheKey withExtension:[self.options valueForKey:CONFIG_FILE_EXT]];
155155
if ([[NSFileManager defaultManager] fileExistsAtPath:destPath]) {
156-
callback(@[[NSNull null], destPath]);
156+
callback(@[[NSNull null], @[[NSNull null], destPath]);
157157
return;
158158
}
159159
}
@@ -190,7 +190,7 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
190190
- (void) URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler
191191
{
192192
expectedBytes = [response expectedContentLength];
193-
193+
194194
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
195195
NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode];
196196
if ([response respondsToSelector:@selector(allHeaderFields)])
@@ -229,7 +229,7 @@ - (void) URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dat
229229
@"timeout" : @NO,
230230
@"status": [NSString stringWithFormat:@"%d", statusCode ]
231231
};
232-
232+
233233
[self.bridge.eventDispatcher
234234
sendDeviceEventWithName: EVENT_STATE_CHANGE
235235
body:respInfo
@@ -272,7 +272,7 @@ - (void) URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dat
272272
{
273273
[writeStream write:[data bytes] maxLength:[data length]];
274274
}
275-
275+
276276
if([progressTable valueForKey:taskId] == @YES)
277277
{
278278
[self.bridge.eventDispatcher
@@ -296,15 +296,15 @@ - (void) URLSession:(NSURLSession *)session didBecomeInvalidWithError:(nullable
296296

297297
- (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
298298
{
299-
299+
300300
self.error = error;
301301
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
302-
302+
303303
NSString * respType = [respInfo valueForKey:@"respType"];
304304
if(error != nil) {
305305
NSLog([error localizedDescription]);
306306
}
307-
307+
308308
if(respFile == YES)
309309
{
310310
[writeStream close];
@@ -321,7 +321,7 @@ - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCom
321321
[respData base64EncodedStringWithOptions:0]
322322
]);
323323
}
324-
324+
325325
[taskTable removeObjectForKey:taskId];
326326
[uploadProgressTable removeObjectForKey:taskId];
327327
[progressTable removeObjectForKey:taskId];

0 commit comments

Comments
 (0)