marinofaggiana 4 years ago
parent
commit
d8e1af1e6a
1 changed files with 20 additions and 0 deletions
  1. 20 0
      iOSClient/Networking/NCNetworkingE2EE.swift

+ 20 - 0
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -256,19 +256,39 @@ import NCCommunication
                     }
             
                     var method = ""
+                    let communication = OCNetworking.sharedManager()?.sharedOCCommunication()
+                    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+
                     if errorCode == 0 && existsMetadata != nil {
+                       
+                        communication?.updateEnd(toEndMetadata: appDelegate.activeUrl+"/", fileId: fileId, encryptedMetadata: metadata, e2eToken: e2eToken, on: communication, successRequest: { (response, a, b) in
+                            
+                        }, failureRequest: { (response, error, b) in
+                            
+                        })
                         method = "PUT"
+                        
                     } else if  errorCode == 404 {
                         method = "POST"
+                        
+                        communication?.storeEnd(toEndMetadata: appDelegate.activeUrl+"/", fileId: fileId, e2eToken: e2eToken, encryptedMetadata: metadata, on: communication, successRequest: { (response, a, b) in
+                            
+                        }, failureRequest: { (response, error, b) in
+                            
+                        })
+                        
                     } else {
                         completion(errorCode, errorDescription)
                     }
                
+                    
+                    /*
                     NCCommunication.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken!, method: method, metadata: metadata) { (account, metadata, errorCodeSendMetadata, errorDescriptionSendMetadata) in
                         
                         self.unlock(serverUrl: serverUrl, fileId: fileId) { (errorCode, errorDescription) in }
                         completion(errorCode, errorDescription)
                     }
+                    */
                 }
             } else {
                 completion(errorCode, errorDescription)