فهرست منبع

Update library

marinofaggiana 4 سال پیش
والد
کامیت
5b505a2c35

+ 5 - 11
File Provider Extension/FileProviderExtension.swift

@@ -187,8 +187,6 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
         
         let pathComponents = url.pathComponents
         let identifier = NSFileProviderItemIdentifier(pathComponents[pathComponents.count - 2])
-        var downloadRequest: DownloadRequest?
-        var task: URLSessionTask?
         
         if let _ = outstandingSessionTasks[url] {
             completionHandler(nil)
@@ -214,17 +212,13 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
         fileProviderData.shared.signalEnumerator(ocId: metadata.ocId, update: true)
         
         NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath,  requestHandler: { (request) in
+                        
+        }, taskHandler: { (task) in
             
-            downloadRequest = request
-            
-        }, progressHandler: { (progress) in
+            self.outstandingSessionTasks[url] = task
+            fileProviderData.shared.fileProviderManager.register(task, forItemWithIdentifier: NSFileProviderItemIdentifier(identifier.rawValue)) { (error) in }
             
-            if task == nil && downloadRequest?.task != nil {
-                task = downloadRequest?.task
-                self.outstandingSessionTasks[url] = task
-                
-                fileProviderData.shared.fileProviderManager.register(task!, forItemWithIdentifier: NSFileProviderItemIdentifier(identifier.rawValue)) { (error) in }
-            }
+        }, progressHandler: { (_) in
             
         }) { (account, etag, date, length, allHeaderFields, error, errorCode, errorDescription) in
             

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2766,8 +2766,8 @@
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/nextcloud/ios-communication-library/";
 			requirement = {
-				kind = exactVersion;
-				version = 0.83.0;
+				kind = revision;
+				revision = c9e1ad1e6fb7a0eb95e77bec19b9d08d5e5a6917;
 			};
 		};
 		F7C4D88B2534887E00C142DA /* XCRemoteSwiftPackageReference "Parchment" */ = {

+ 3 - 3
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -14,9 +14,9 @@
         "package": "NCCommunication",
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
-          "branch": null,
-          "revision": "b7411d3fbacff62276d597b136da97217eefb86a",
-          "version": "0.83.0"
+          "branch": "develop",
+          "revision": "5d3d5fbed17b1be5a078acd9dc144eedc71fd8e9",
+          "version": null
         }
       },
       {

+ 6 - 1
Share/ShareViewController.m

@@ -272,9 +272,14 @@
         NSString *fileNameForUpload = [[NCUtility shared] createFileName:fileName serverUrl:self.serverUrl account:self.account];
         NSString *fileNameServer = [NSString stringWithFormat:@"%@/%@", self.serverUrl, fileNameForUpload];
         
-        [[NCCommunication shared] uploadWithServerUrlFileName:fileNameServer fileNameLocalPath:fileNameLocal dateCreationFile:nil dateModificationFile:nil customUserAgent:nil addCustomHeaders:nil progressHandler:^(NSProgress * progress) {
+        [[NCCommunication shared] uploadWithServerUrlFileName:fileNameServer fileNameLocalPath:fileNameLocal dateCreationFile:nil dateModificationFile:nil customUserAgent:nil addCustomHeaders:nil taskHandler:^(NSURLSessionTask *task) {
+                        
+        } progressHandler:^(NSProgress *progress) {
+            
             [self.hud progress:progress.fractionCompleted];
+            
         } completionHandler:^(NSString *account, NSString *ocId, NSString *etag, NSDate *date, int64_t size, NSDictionary *allHeaderFields, NSInteger errorCode, NSString *errorDescription) {
+            
             [self.hud hideHud];
             [self.filesName removeObject:fileName];
            

+ 2 - 0
iOSClient/Activity/NCActivity.swift

@@ -386,6 +386,8 @@ extension activityTableViewCell: UICollectionViewDelegate {
             
             NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
                 
+            }, taskHandler: { (_) in
+                
             }, progressHandler: { (_) in
                 
             }) { (account, etag, date, lenght, allHeaderFields, error, errorCode, errorDescription) in

+ 2 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -504,6 +504,8 @@ import NCCommunication
 
         NCCommunication.shared.download(serverUrlFileName: preview, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
             
+        }, taskHandler: { (_) in
+            
         }, progressHandler: { (_) in
             
         }) { (account, etag, date, lenght, allHeaderFields, error, errorCode, errorDescription) in

+ 13 - 11
iOSClient/Networking/NCNetworking.swift

@@ -255,6 +255,8 @@ import Queuer
             NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, status: Int(k_metadataStatusDownloading))
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadStartFile, userInfo: ["metadata":metadata])
             
+        }, taskHandler: { (_) in
+            
         }, progressHandler: { (progress) in
             
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_progressTask, object: nil, userInfo: ["account":metadata.account, "ocId":metadata.ocId, "serverUrl":metadata.serverUrl, "status":NSNumber(value: k_metadataStatusInDownload), "progress":NSNumber(value: progress.fractionCompleted), "totalBytes":NSNumber(value: progress.totalUnitCount), "totalBytesExpected":NSNumber(value: progress.completedUnitCount)])
@@ -376,30 +378,30 @@ import Queuer
         
         let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
         let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
-        var task: URLSessionTask?
+        var uploadTask: URLSessionTask?
         let description = metadata.ocId
         
         NCCommunication.shared.upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: metadata.creationDate as Date, dateModificationFile: metadata.date as Date, customUserAgent: nil, addCustomHeaders: nil, requestHandler: { (request) in
             
             self.uploadRequest[fileNameLocalPath] = request
+        
+        }, taskHandler: { (task) in
             
-        }, progressHandler: { (progress) in
+            uploadTask = task
+            NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: Int(k_metadataStatusUploading))
+            #if !EXTENSION
+            CCGraphics.createNewImage(from: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, typeFile: metadata.typeFile)
+            #endif
+            NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadStartFile, userInfo: ["metadata":metadata])
             
-            if task == nil && self.uploadRequest[fileNameLocalPath]?.task != nil {
-                task = self.uploadRequest[fileNameLocalPath]?.task
-                NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task!.taskIdentifier, status: Int(k_metadataStatusUploading))
-                #if !EXTENSION
-                CCGraphics.createNewImage(from: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, typeFile: metadata.typeFile)
-                #endif
-                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadStartFile, userInfo: ["metadata":metadata])
-            }
+        }, progressHandler: { (progress) in
             
             NotificationCenter.default.postOnMainThread(name: k_notificationCenter_progressTask, userInfo: ["account":metadata.account, "ocId":metadata.ocId, "serverUrl":metadata.serverUrl, "status":NSNumber(value: k_metadataStatusInUpload), "progress":NSNumber(value: progress.fractionCompleted), "totalBytes":NSNumber(value: progress.totalUnitCount), "totalBytesExpected":NSNumber(value: progress.completedUnitCount)])
             
         }) { (account, ocId, etag, date, size, allHeaderFields, error, errorCode, errorDescription) in
          
             self.uploadRequest[fileNameLocalPath] = nil
-            self.uploadComplete(fileName: metadata.fileName, serverUrl: metadata.serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task!, errorCode: errorCode, errorDescription: errorDescription)
+            self.uploadComplete(fileName: metadata.fileName, serverUrl: metadata.serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: uploadTask!, errorCode: errorCode, errorDescription: errorDescription)
             
             completion(errorCode, errorDescription)
         }

+ 2 - 0
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -270,6 +270,8 @@ import Alamofire
                     NCManageDatabase.sharedInstance.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: nil, sessionSelector: nil, sessionTaskIdentifier: nil, status: Int(k_metadataStatusUploading))
                     
                     NotificationCenter.default.postOnMainThread(name: k_notificationCenter_uploadStartFile, userInfo: ["metadata":metadata])
+                
+                }, taskHandler: { (_) in
                     
                 }, progressHandler: { (progress) in
                     

+ 2 - 0
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -296,6 +296,8 @@ class NCViewerImage: UIViewController {
                                     
                     NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
                         
+                    }, taskHandler: { (_) in
+                        
                     }, progressHandler: { (progress) in
                                         
                         self.progressView.progress = Float(progress.fractionCompleted)

+ 2 - 0
iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift

@@ -182,6 +182,8 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
                         
                         NCCommunication.shared.download(serverUrlFileName: url, fileNameLocalPath: fileNameLocalPath, requestHandler: { (_) in
                             
+                        }, taskHandler: { (_) in
+                            
                         }, progressHandler: { (_) in
                             
                         }, completionHandler: { (account, etag, date, lenght, allHeaderFields, error, errorCode, errorDescription) in