|
@@ -112,20 +112,12 @@
|
112
|
112
|
callback(@[[error localizedDescription]]);
|
113
|
113
|
return;
|
114
|
114
|
}
|
115
|
|
- else
|
|
115
|
+ else {
|
116
|
116
|
callback(@[[NSNull null], [resp base64EncodedStringWithOptions:0]]);
|
|
117
|
+ }
|
117
|
118
|
}];
|
118
|
|
-// [session uploadTaskWithRequest:req fromData:data completionHandler:^(NSData * _Nullable resp, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
119
|
|
-// if(error != nil) {
|
120
|
|
-// callback(@[[error localizedDescription]]);
|
121
|
|
-// return;
|
122
|
|
-// }
|
123
|
|
-// else
|
124
|
|
-// callback(@[[NSNull null], [resp base64EncodedStringWithOptions:0]]);
|
125
|
|
-// }];
|
126
|
119
|
[task resume];
|
127
|
120
|
}
|
128
|
|
-// callback(@[[NSString stringWithFormat:@"RNFetchBlob could not initialize connection"], [NSNull null]]);
|
129
|
121
|
}
|
130
|
122
|
|
131
|
123
|
|
|
@@ -171,59 +163,4 @@
|
171
|
163
|
];
|
172
|
164
|
}
|
173
|
165
|
|
174
|
|
-
|
175
|
|
-//- (void) URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session
|
176
|
|
-//{
|
177
|
|
-//
|
178
|
|
-//}
|
179
|
|
-
|
180
|
|
-
|
181
|
|
-//- (void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
|
182
|
|
-//
|
183
|
|
-// // [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
|
184
|
|
-//
|
185
|
|
-// [self.fileStream closeInStream];
|
186
|
|
-// [self.fileStream closeOutStream];
|
187
|
|
-//
|
188
|
|
-// callback(@[[error localizedDescription], [NSNull null]]);
|
189
|
|
-//}
|
190
|
|
-
|
191
|
|
-
|
192
|
|
-
|
193
|
|
-
|
194
|
|
-// handle 301 and 302 responses
|
195
|
|
-//- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:response {
|
196
|
|
-// return request;
|
197
|
|
-//}
|
198
|
|
-
|
199
|
|
-// request complete
|
200
|
|
-//- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
|
201
|
|
-//
|
202
|
|
-// NSData * data;
|
203
|
|
-// if(respData != nil)
|
204
|
|
-// data = [NSData dataWithData:respData];
|
205
|
|
-// else
|
206
|
|
-// data = [[NSData alloc] init];
|
207
|
|
-//
|
208
|
|
-// NSString * path = [self.options valueForKey:CONFIG_FILE_PATH];
|
209
|
|
-// NSString * ext = [self.options valueForKey:CONFIG_FILE_EXT];
|
210
|
|
-// Boolean useCache = [self.options valueForKey:CONFIG_USE_TEMP];
|
211
|
|
-//
|
212
|
|
-// [self.fileStream closeInStream];
|
213
|
|
-//
|
214
|
|
-// // if fileCache is true or file path is given, return a path
|
215
|
|
-// if( path != nil ) {
|
216
|
|
-// callback(@[[NSNull null], path]);
|
217
|
|
-// }
|
218
|
|
-// // when fileCache option is set but no path specified, save to tmp path
|
219
|
|
-// else if( [self.options valueForKey:CONFIG_USE_TEMP] != nil) {
|
220
|
|
-// NSString * tmpPath = [RNFetchBlobFS getTempPath:taskId withExtension:ext];
|
221
|
|
-// callback(@[[NSNull null], tmpPath]);
|
222
|
|
-// }
|
223
|
|
-// // otherwise return base64 string
|
224
|
|
-// else {
|
225
|
|
-// callback(@[[NSNull null], [data base64EncodedStringWithOptions:0]]);
|
226
|
|
-// }
|
227
|
|
-//}
|
228
|
|
-
|
229
|
166
|
@end
|