浏览代码

restore old <selector Upload File>

Marino Faggiana 7 年之前
父节点
当前提交
6bb7a3d967
共有 1 个文件被更改,包括 9 次插入11 次删除
  1. 9 11
      iOSClient/AppDelegate.m

+ 9 - 11
iOSClient/AppDelegate.m

@@ -1489,24 +1489,22 @@
     
     if (counterUploadInSessionAndInLock < maxConcurrentDownloadUpload && counterUploadInLock < 1) {
         
-        metadataNet = [[NCManageDatabase sharedInstance] getQueueUpload];
+        metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadFile];
         if (metadataNet) {
             
             if (metadataNet.path == nil)  {
-                metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadFile];
+                
                 [[CCNetworking sharedNetworking] uploadFileFromAssetLocalIdentifier:metadataNet delegate:_activeMain];
-                counterNewUpload++;
+
             } else {
-                if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateBackground) {
-                    metadataNet = [[NCManageDatabase sharedInstance] getQueueUploadLockWithSelector:selectorUploadFile];
-                    NSString *toPath = [NSString stringWithFormat:@"%@/%@", self.directoryUser, metadataNet.fileName];
-                    [CCUtility copyFileAtPath:metadataNet.path toPath:toPath];
-                    [[CCNetworking sharedNetworking] uploadFile:metadataNet.fileName serverUrl:metadataNet.serverUrl assetLocalIdentifier:metadataNet.assetLocalIdentifier session:metadataNet.session taskStatus:k_taskStatusResume selector:metadataNet.selector selectorPost:metadataNet.selectorPost errorCode:0 delegate:nil];
-                    counterNewUpload++;
-                }
+                
+                [CCUtility copyFileAtPath:metadataNet.path toPath:[NSString stringWithFormat:@"%@/%@", self.directoryUser, metadataNet.fileName]];
+                [[CCNetworking sharedNetworking] uploadFile:metadataNet.fileName serverUrl:metadataNet.serverUrl assetLocalIdentifier:metadataNet.assetLocalIdentifier session:metadataNet.session taskStatus:k_taskStatusResume selector:metadataNet.selector selectorPost:metadataNet.selectorPost errorCode:0 delegate:nil];
             }
+            
+            counterNewUpload++;
         }
-        
+                
         counterUploadInSessionAndInLock = [[[NCManageDatabase sharedInstance] getTableMetadataUpload] count] + [[[NCManageDatabase sharedInstance] getTableMetadataUploadWWan] count] + [[[NCManageDatabase sharedInstance] getQueueUploadInLock] count];
     }