marinofaggiana há 4 anos atrás
pai
commit
c6518e1b97
1 ficheiros alterados com 5 adições e 7 exclusões
  1. 5 7
      iOSClient/Networking/NCNetworking.swift

+ 5 - 7
iOSClient/Networking/NCNetworking.swift

@@ -476,14 +476,8 @@ import Queuer
                             let serverUrlFileName = uploadFolder + "/" + fileName
                             let fileNameChunkLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileName)!
                             let semaphore = Semaphore()
-                            
                             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 - totalBytes
 
-                            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)])
-                            
                             NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameChunkLocalPath, requestHandler: { (request) in
                                     
                                 self.uploadRequest[fileNameLocalPath] = request
@@ -495,7 +489,11 @@ import Queuer
                                 
                             }, progressHandler: { (_) in
                                 
-                                
+                                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)])
                                 
                             }) { (account, ocId, etag, date, size, allHeaderFields, error, errorCode, errorDescription) in