@@ -433,23 +433,22 @@ - (void) hydrateFromDB:(NSMutableDictionary *) tempMultiPartMasterTaskDictionary
433
433
}
434
434
}
435
435
436
- - (void ) linkTransfersToNSURLSession : (NSMutableDictionary *) tempMultiPartMasterTaskDictionary
437
- tempTransferDictionary : (NSMutableDictionary *) tempTransferDictionary
438
- completionHandler : (void (^)(NSError *_Nullable error)) completionHandler {
436
+ - (void )linkTransfersToNSURLSession : (NSMutableDictionary *) tempMultiPartMasterTaskDictionary
437
+ tempTransferDictionary : (NSMutableDictionary *)tempTransferDictionary
438
+ completionHandler : (void (^)(NSError *_Nullable error)) completionHandler {
439
439
// Get tasks from the NSURLSession and reattach to them.
440
440
// getTasksWithCompletionHandler is an ansynchronous task, so the thread that is calling this method will not be blocked.
441
441
[self .session getTasksWithCompletionHandler: ^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
442
-
442
+
443
443
// Loop through all the upload Tasks.
444
- for ( NSURLSessionUploadTask *task in uploadTasks) {
444
+ for ( NSURLSessionUploadTask *task in uploadTasks) {
445
445
AWSDDLogDebug (@" Iterating through task Identifier [%lu ]" , (unsigned long )task.taskIdentifier );
446
446
NSError *taskError = [task error ];
447
-
447
+
448
448
// Get the Task
449
449
id obj = [tempTransferDictionary objectForKey: @(task.taskIdentifier)];
450
-
451
- if ([obj isKindOfClass: [AWSS3TransferUtilityUploadTask class ]])
452
- {
450
+
451
+ if ([obj isKindOfClass: [AWSS3TransferUtilityUploadTask class ]]) {
453
452
// Found a upload task.
454
453
AWSS3TransferUtilityUploadTask *uploadTask = obj;
455
454
uploadTask.sessionTask = task;
@@ -469,11 +468,11 @@ - (void) linkTransfersToNSURLSession:(NSMutableDictionary *) tempMultiPartMaster
469
468
filePath: uploadTask.file];
470
469
continue ;
471
470
}
472
-
471
+
473
472
// Check if it is InProgress
474
473
if (uploadTask.status == AWSS3TransferUtilityTransferStatusInProgress) {
475
474
// Check if the the underlying NSURLSession task is completed. If so, delete the record from the DB, clean up any temp files and call the completion handler.
476
- if ([ task state ] == NSURLSessionTaskStateCompleted ) {
475
+ if (task. state == NSURLSessionTaskStateCompleted ) {
477
476
// Set progress to 100%
478
477
uploadTask.progress .completedUnitCount = uploadTask.progress .totalUnitCount ;
479
478
uploadTask.status = AWSS3TransferUtilityTransferStatusCompleted;
@@ -484,7 +483,7 @@ - (void) linkTransfersToNSURLSession:(NSMutableDictionary *) tempMultiPartMaster
484
483
continue ;
485
484
}
486
485
// If it is in any other status than running, then we need to recover by retrying.
487
- if ([ task state ] != NSURLSessionTaskStateRunning ) {
486
+ if (task. state != NSURLSessionTaskStateRunning ) {
488
487
// We think the task in IN_PROGRESS. The underlying task is not running.
489
488
// Recover the situation by retrying.
490
489
[self retryUpload: uploadTask];
@@ -522,15 +521,15 @@ - (void) linkTransfersToNSURLSession:(NSMutableDictionary *) tempMultiPartMaster
522
521
// Check if this is in progress
523
522
if (downloadTask.status == AWSS3TransferUtilityTransferStatusInProgress) {
524
523
525
- if ([ task state ] == NSURLSessionTaskStateCompleted ) {
524
+ if (task. state == NSURLSessionTaskStateCompleted ) {
526
525
// Set progress to 100%
527
526
downloadTask.progress .completedUnitCount = downloadTask.progress .totalUnitCount ;
528
527
downloadTask.status = AWSS3TransferUtilityTransferStatusCompleted;
529
528
[self markTransferAsCompleted: downloadTask taskError: taskError temporaryFileCreated: NO filePath: @" " ];
530
529
continue ;
531
530
}
532
531
// Check if the underlying task's status is not in Progress.
533
- else if ([ task state ] != NSURLSessionTaskStateRunning ) {
532
+ else if (task. state != NSURLSessionTaskStateRunning ) {
534
533
// We think the task in Progress. The underlying task is not in progress.
535
534
// Recover the situation by retrying
536
535
[self retryDownload: downloadTask];
@@ -716,10 +715,9 @@ - (AWSS3TransferUtilityDownloadTask *)hydrateDownloadTask:(NSMutableDictionary *
716
715
}
717
716
718
717
719
- -( AWSS3TransferUtilityMultiPartUploadTask *) hydrateMultiPartUploadTask : (NSMutableDictionary *) task
720
- sessionIdentifier : (NSString *) sessionIdentifier
721
- databaseQueue : (AWSFMDatabaseQueue *) databaseQueue
722
- {
718
+ - (AWSS3TransferUtilityMultiPartUploadTask *)hydrateMultiPartUploadTask : (NSMutableDictionary *) task
719
+ sessionIdentifier : (NSString *) sessionIdentifier
720
+ databaseQueue : (AWSFMDatabaseQueue *) databaseQueue {
723
721
AWSS3TransferUtilityMultiPartUploadTask *transferUtilityMultiPartUploadTask = [AWSS3TransferUtilityMultiPartUploadTask new ];
724
722
[transferUtilityMultiPartUploadTask integrateWithTransferUtility: self ];
725
723
transferUtilityMultiPartUploadTask.nsURLSessionID = sessionIdentifier;
0 commit comments