|
@@ -1493,7 +1493,7 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Verify Downloading
|
|
|
+ // Verify Transfer
|
|
|
// TODO: move in new acrivity/transfers view
|
|
|
//
|
|
|
if (counterNewDownloadUpload == 0) {
|
|
@@ -1523,10 +1523,34 @@
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
+
|
|
|
+ NSArray *recordsInUploading = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND session != %@ AND status == %d", self.activeAccount, k_download_session_extension, k_metadataStatusUploading] sorted:@"fileName" ascending:true];
|
|
|
+ for (tableMetadata *metadata in recordsInUploading) {
|
|
|
+
|
|
|
+ NSURLSession *session = [[CCNetworking sharedNetworking] getSessionfromSessionDescription:metadata.session];
|
|
|
+
|
|
|
+ [session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
|
|
|
+
|
|
|
+ NSURLSessionTask *findTask;
|
|
|
+
|
|
|
+ for (NSURLSessionTask *task in uploadTasks) {
|
|
|
+ if (task.taskIdentifier == metadata.sessionTaskIdentifier) {
|
|
|
+ findTask = task;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!findTask) {
|
|
|
+
|
|
|
+ metadata.sessionError = @"Internal error, task not found";
|
|
|
+ metadata.sessionTaskIdentifier = k_taskIdentifierDone;
|
|
|
+ metadata.status = k_metadataStatusUploadError;
|
|
|
+
|
|
|
+ (void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-// NSArray *recordsInUpload = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d)", self.activeAccount, k_metadataStatusInUpload, k_metadataStatusUploading] sorted:@"fileName" ascending:true];
|
|
|
-
|
|
|
// Start Timer
|
|
|
_timerProcessAutoDownloadUpload = [NSTimer scheduledTimerWithTimeInterval:k_timerProcessAutoDownloadUpload target:self selector:@selector(processAutoDownloadUpload) userInfo:nil repeats:YES];
|
|
|
}
|