marinofaggiana 4 年之前
父节点
当前提交
4ae865ca0d

+ 11 - 6
iOSClient/Main/Collection/NCCollectionViewCommon.swift

@@ -694,7 +694,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
     
     
     @objc func copyFileMenu(_ notification: Any) {
     @objc func copyFileMenu(_ notification: Any) {
         var metadatas: [tableMetadata] = []
         var metadatas: [tableMetadata] = []
-        var items = [[String : Any]]()
+        var items = UIPasteboard.general.items
 
 
         if isEditMode {
         if isEditMode {
             for ocId in selectOcId {
             for ocId in selectOcId {
@@ -708,11 +708,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         }
         }
                 
                 
         for metadata in metadatas {
         for metadata in metadatas {
-            do {
-                let data = try NSKeyedArchiver.archivedData(withRootObject: metadata.ocId, requiringSecureCoding: false)
-                items.append([k_metadataKeyedUnarchiver:data])
-            } catch {
-                print("error")
+            
+            if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
+                do {
+                    let data = try NSKeyedArchiver.archivedData(withRootObject: metadata.ocId, requiringSecureCoding: false)
+                    items.append([k_metadataKeyedUnarchiver:data])
+                } catch {
+                    print("error")
+                }
+            } else {
+                NotificationCenter.default.postOnMainThread(name: k_notificationCenter_downloadedFile, userInfo: ["metadata": metadata, "selector": selectorLoadCopy, "errorCode": 0, "errorDescription": "" ])
             }
             }
         }
         }
         
         

+ 10 - 1
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -100,7 +100,16 @@ import Foundation
                         
                         
                     case selectorLoadCopy:
                     case selectorLoadCopy:
                         
                         
-                        appDelegate.activeMain.copyFile(toPasteboard: metadata)
+                        var items = UIPasteboard.general.items
+                        
+                        do {
+                            let data = try NSKeyedArchiver.archivedData(withRootObject: metadata.ocId, requiringSecureCoding: false)
+                            items.append([k_metadataKeyedUnarchiver:data])
+                        } catch {
+                            print("error")
+                        }
+                        
+                        UIPasteboard.general.setItems(items, options: [:])
                         
                         
                     case selectorLoadOffline:
                     case selectorLoadOffline: