marinofaggiana 4 vuotta sitten
vanhempi
commit
a1bc26057e
1 muutettua tiedostoa jossa 10 lisäystä ja 9 poistoa
  1. 10 9
      iOSClient/Networking/NCNetworking.swift

+ 10 - 9
iOSClient/Networking/NCNetworking.swift

@@ -476,25 +476,26 @@ import Queuer
                             let serverUrlFileName = uploadFolder + "/" + fileName
                             let fileNameChunkLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileName)!
                             let semaphore = Semaphore()
-                            counterFileNameInUpload += 1
-
+                                                        
                             NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameChunkLocalPath, requestHandler: { (request) in
                                     
                                 self.uploadRequest[fileNameLocalPath] = request
                                 
-                            }, taskHandler: { (task) in
-                                
-                                NCManageDatabase.shared.setMetadataSession(ocId: ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading)
-                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadStartFile, userInfo: ["ocId": ocId])
-                                
-                            }, progressHandler: { (_) in
-                                
+                                counterFileNameInUpload += 1
+
                                 let progress: Float = Float(counterFileNameInUpload) / Float(filesNames.count)
                                 let totalBytes: Int64 = (metadata.size / Int64(filesNames.count)) * Int64(counterFileNameInUpload)
                                 let totalBytesExpected: Int64 = metadata.size
 
                                 NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterProgressTask, userInfo: ["account":metadata.account, "ocId":metadata.ocId, "serverUrl":metadata.serverUrl, "status":NSNumber(value: NCGlobal.shared.metadataStatusInUpload), "progress":NSNumber(value: progress), "totalBytes":NSNumber(value: totalBytes), "totalBytesExpected":NSNumber(value: totalBytesExpected)])
                                 
+                            }, taskHandler: { (task) in
+                                
+                                NCManageDatabase.shared.setMetadataSession(ocId: ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading)
+                                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadStartFile, userInfo: ["ocId": ocId])
+                                
+                            }, progressHandler: { (_) in                               
+                                
                             }) { (_, _, _, _, _, _, _, errorCode, errorDescription) in
                                    
                                 self.uploadRequest[fileNameLocalPath] = nil