marinofaggiana %!s(int64=4) %!d(string=hai) anos
pai
achega
a2ce741718
Modificáronse 1 ficheiros con 13 adicións e 8 borrados
  1. 13 8
      iOSClient/Networking/NCNetworking.swift

+ 13 - 8
iOSClient/Networking/NCNetworking.swift

@@ -455,12 +455,11 @@ import Queuer
         let folderChunk = NSUUID().uuidString
         let folderChunk = NSUUID().uuidString
         let directoryProviderStorageOcId = CCUtility.getDirectoryProviderStorageOcId(ocId)!
         let directoryProviderStorageOcId = CCUtility.getDirectoryProviderStorageOcId(ocId)!
         let uploadFolder = metadata.urlBase + "/" + NCUtilityFileSystem.shared.getDAV() + "/uploads/" + userId + "/" + folderChunk
         let uploadFolder = metadata.urlBase + "/" + NCUtilityFileSystem.shared.getDAV() + "/uploads/" + userId + "/" + folderChunk
+        let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
         var uploadErrorCode: Int = 0
         var uploadErrorCode: Int = 0
                 
                 
         if let filesNames = NCCommunicationCommon.shared.fileChunks(path: directoryProviderStorageOcId, fileName: metadata.fileName, pathChunks: directoryProviderStorageOcId, sizeInMB: 10) {
         if let filesNames = NCCommunicationCommon.shared.fileChunks(path: directoryProviderStorageOcId, fileName: metadata.fileName, pathChunks: directoryProviderStorageOcId, sizeInMB: 10) {
         
         
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl":serverUrl])
-            
             NCContentPresenter.shared.messageNotification("_info_", description: "_upload_chunk_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode:0, forced: true)
             NCContentPresenter.shared.messageNotification("_info_", description: "_upload_chunk_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode:0, forced: true)
             
             
             NCCommunication.shared.createFolder(uploadFolder) { (account, _, date, errorCode, errorDescription) in
             NCCommunication.shared.createFolder(uploadFolder) { (account, _, date, errorCode, errorDescription) in
@@ -474,17 +473,23 @@ import Queuer
                         for fileName in filesNames {
                         for fileName in filesNames {
                                                         
                                                         
                             let serverUrlFileName = uploadFolder + "/" + fileName
                             let serverUrlFileName = uploadFolder + "/" + fileName
-                            let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileName)!
+                            let fileNameChunkLocalPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileName)!
                             let semaphore = Semaphore()
                             let semaphore = Semaphore()
 
 
-                            NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (request) in
-                                    //
+                            NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameChunkLocalPath, requestHandler: { (request) in
+                                    
+                                self.uploadRequest[fileNameLocalPath] = request
+                                
                             }, taskHandler: { (task) in
                             }, 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: { (progress) in
                             }, progressHandler: { (progress) in
-                                    //
+                                //
                             }) { (account, ocId, etag, date, size, allHeaderFields, error, errorCode, errorDescription) in
                             }) { (account, ocId, etag, date, size, allHeaderFields, error, errorCode, errorDescription) in
-                                    
+                                   
+                                self.uploadRequest[fileNameLocalPath] = nil
                                 uploadErrorCode = errorCode
                                 uploadErrorCode = errorCode
                                 semaphore.continue()
                                 semaphore.continue()
                             }
                             }