瀏覽代碼

improvements

Marino Faggiana 7 年之前
父節點
當前提交
8dbc450cb7
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      PickerFileProvider/FileProvider.swift

+ 6 - 3
PickerFileProvider/FileProvider.swift

@@ -127,10 +127,13 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
             }
         }
         
-        //TODO: verifica se esiste già in coda
+        // verifica se esiste già in coda
         
-        CCNetworking.shared().settingDelegate(self)
-        CCNetworking.shared().uploadFile(fileName, serverUrl: serverUrl, cryptated: false, onlyPlist: false, session: k_upload_session_foreground, taskStatus: Int(k_taskStatusSuspend), selector: nil, selectorPost: nil, errorCode: 0, delegate: self)
+        if NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileName == %@ AND serverUrl == %@ AND session == %@", fileName, serverUrl!, k_upload_session_foreground)) == nil {
+            
+            CCNetworking.shared().settingDelegate(self)
+            CCNetworking.shared().uploadFile(fileName, serverUrl: serverUrl, cryptated: false, onlyPlist: false, session: k_upload_session_foreground, taskStatus: Int(k_taskStatusSuspend), selector: nil, selectorPost: nil, errorCode: 0, delegate: self)
+        }
         
         self.stopProvidingItem(at: url)
     }