浏览代码

Update library NCCommunication

Signed-off-by: marinofaggiana <marino@marinofaggiana.com>
marinofaggiana 3 年之前
父节点
当前提交
5ec664b0e7

+ 1 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -2939,7 +2939,7 @@
 			repositoryURL = "https://github.com/nextcloud/ios-communication-library/";
 			requirement = {
 				kind = revision;
-				revision = 3a993e0072d782e6dfc9f1f7a23212c81a2155aa;
+				revision = 038544310879d38873bf56871aba9899bbc4ca24;
 			};
 		};
 		F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

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

@@ -105,7 +105,7 @@
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
           "branch": null,
-          "revision": "3a993e0072d782e6dfc9f1f7a23212c81a2155aa",
+          "revision": "038544310879d38873bf56871aba9899bbc4ca24",
           "version": null
         }
       },

+ 30 - 34
iOSClient/Main/NCFunctionCenter.swift

@@ -228,47 +228,43 @@ import Queuer
         
         NCUtility.shared.startActivityIndicator(backgroundView: nil, blurEffect: true)
         
-        DispatchQueue.global().async {
-            
-            var error: Int = 0
-            var items: [Any] = []
+        var error: Int = 0
+        var items: [Any] = []
 
-            for ocId in selectOcId {
-                if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
-                    if metadata.directory {
-                        continue
-                    }
-                    if !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
-                        let semaphore = Semaphore()
-                        NCNetworking.shared.download(metadata: metadata, selector: "") { errorCode in
-                            error = errorCode
-                            semaphore.continue()
-                        }
-                        semaphore.wait()
-                    }
-                    if error != 0 {
-                        break
+        for ocId in selectOcId {
+            if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
+                if metadata.directory {
+                    continue
+                }
+                if !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
+                    let semaphore = Semaphore()
+                    NCNetworking.shared.download(metadata: metadata, selector: "") { errorCode in
+                        error = errorCode
+                        semaphore.continue()
                     }
-                    let fileURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
-                    items.append(fileURL)
+                    semaphore.wait()
                 }
+                if error != 0 {
+                    break
+                }
+                let fileURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
+                items.append(fileURL)
             }
-            if error == 0 && items.count > 0 {
-                DispatchQueue.main.async {
+        }
+        if error == 0 && items.count > 0 {
+              
+            guard let mainTabBar = self.appDelegate.mainTabBar else { return }
                     
-                    guard let mainTabBar = self.appDelegate.mainTabBar else { return }
-                            
-                    let activityViewController = UIActivityViewController.init(activityItems: items, applicationActivities: nil)
+            let activityViewController = UIActivityViewController.init(activityItems: items, applicationActivities: nil)
 
-                    activityViewController.popoverPresentationController?.permittedArrowDirections = .any
-                    activityViewController.popoverPresentationController?.sourceView = mainTabBar
-                    activityViewController.popoverPresentationController?.sourceRect = mainTabBar.menuRect
-                    
-                    self.appDelegate.window?.rootViewController?.present(activityViewController, animated: true)
-                }
-            }
-            NCUtility.shared.stopActivityIndicator()
+            activityViewController.popoverPresentationController?.permittedArrowDirections = .any
+            activityViewController.popoverPresentationController?.sourceView = mainTabBar
+            activityViewController.popoverPresentationController?.sourceRect = mainTabBar.menuRect
+            
+            self.appDelegate.window?.rootViewController?.present(activityViewController, animated: true)
+            
         }
+        NCUtility.shared.stopActivityIndicator()
     }
         
     // MARK: - Save as scan

+ 0 - 1
iOSClient/Menu/NCViewer+Menu.swift

@@ -96,7 +96,6 @@ extension NCViewer {
                     icon: NCUtility.shared.loadImage(named: "tray.and.arrow.down"),
                     action: { menuAction in
                         if ((localFile == nil || !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView)) && metadata.session == "") {
-                            
                             NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorLoadOffline) { (_) in }
                         } else {
                             NCManageDatabase.shared.setLocalFile(ocId: metadata.ocId, offline: !localFile!.offline)

+ 3 - 3
iOSClient/Networking/NCNetworking.swift

@@ -403,7 +403,7 @@ import Queuer
                 
         NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: NCCommunicationCommon.shared.sessionIdentifierDownload, sessionError: "", sessionSelector: selector, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusInDownload)
                     
-        NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { (request) in
+        NCCommunication.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, queue: NCCommunicationCommon.shared.backgroundQueue, requestHandler: { (request) in
             
             self.downloadRequest[fileNameLocalPath] = request
             
@@ -482,9 +482,9 @@ import Queuer
             metadata = tableMetadata.init(value: metadata)
            
             if metadata.e2eEncrypted {
-                #if !EXTENSION_FILE_PROVIDER_EXTENSION
+#if !EXTENSION_FILE_PROVIDER_EXTENSION
                 NCNetworkingE2EE.shared.upload(metadata: tableMetadata.init(value: metadata), start: { start() }, completion: completion)
-                #endif
+#endif
             } else if metadata.chunk {
                 uploadChunkedFile(metadata: metadata, start: { start() }, completion: completion)
             } else if metadata.session == NCCommunicationCommon.shared.sessionIdentifierUpload {