@ammarahmed/react-native-upload 6.32.0 → 6.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -332,30 +332,35 @@ RCT_EXPORT_METHOD(getAllUploads : (RCTPromiseResolveBlock)
332
332
  NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
333
333
  NSMutableArray *uploads = [NSMutableArray new];
334
334
  for (NSURLSessionUploadTask *uploadTask in uploadTasks) {
335
- NSString *state = @"unknown"; // Default initialization
336
- switch (uploadTask.state) {
337
- case NSURLSessionTaskStateRunning:
338
- state = @"running";
339
- break;
340
- case NSURLSessionTaskStateSuspended:
341
- state = @"pending";
342
- break;
343
- case NSURLSessionTaskStateCanceling:
344
- state = @"cancelled";
345
- break;
346
- case NSURLSessionTaskStateCompleted:
347
- state = @"completed";
348
- break;
349
- default: // Handle unexpected states
350
- state = @"unknown";
351
- break;
352
- }
335
+ @try {
336
+ NSString *state = @"unknown"; // Default initialization
337
+ switch (uploadTask.state) {
338
+ case NSURLSessionTaskStateRunning:
339
+ state = @"running";
340
+ break;
341
+ case NSURLSessionTaskStateSuspended:
342
+ state = @"pending";
343
+ break;
344
+ case NSURLSessionTaskStateCanceling:
345
+ state = @"cancelled";
346
+ break;
347
+ case NSURLSessionTaskStateCompleted:
348
+ state = @"completed";
349
+ break;
350
+ default: // Handle unexpected states
351
+ state = @"unknown";
352
+ break;
353
+ }
353
354
 
354
- NSDictionary *upload = @{
355
- @"id" : uploadTask.taskDescription ?: @"", // Null safety
356
- @"state" : state
357
- };
358
- [uploads addObject:upload];
355
+ NSDictionary *upload = @{
356
+ @"id" : uploadTask.taskDescription ?: @"", // Null safety
357
+ @"state" : state
358
+ };
359
+ [uploads addObject:upload];
360
+ } @catch (NSException *exception) {
361
+ NSDictionary *upload = @{ @"id" : @"", @"state" : @"unknown" };
362
+ [uploads addObject:upload];
363
+ }
359
364
  }
360
365
  resolve(uploads);
361
366
  }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ammarahmed/react-native-upload",
3
- "version": "6.32.0",
3
+ "version": "6.33.0",
4
4
  "description": "Cross platform http post file uploader with Android and iOS background support.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",