|
@@ -148,7 +148,7 @@ import NCCommunication
|
|
|
|
|
|
@objc func readFolder(serverUrl: String, account: String, completion: @escaping (_ account: String, _ metadataFolder: tableMetadata?, _ metadatas: [tableMetadata]?, _ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
|
|
|
- NCCommunication.sharedInstance.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 && files != nil {
|
|
|
|
|
@@ -202,7 +202,7 @@ import NCCommunication
|
|
|
|
|
|
@objc func readFile(serverUrlFileName: String, account: String, completion: @escaping (_ account: String, _ metadata: tableMetadata?, _ errorCode: Int, _ errorDescription: String)->()) {
|
|
|
|
|
|
- NCCommunication.sharedInstance.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 && files != nil {
|
|
|
if files?.count ?? 0 == 1 {
|
|
@@ -246,7 +246,7 @@ import NCCommunication
|
|
|
}
|
|
|
let fileNameFolderUrl = serverUrl + "/" + fileNameFolder
|
|
|
|
|
|
- NCCommunication.sharedInstance.createFolder(fileNameFolderUrl, customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, ocId, date, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.createFolder(fileNameFolderUrl, customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, ocId, date, errorCode, errorDescription) in
|
|
|
if errorCode == 0 {
|
|
|
self.readFile(serverUrlFileName: fileNameFolderUrl, account: account) { (account, metadataFolder, errorCode, errorDescription) in
|
|
|
if errorCode == 0 {
|
|
@@ -316,7 +316,7 @@ import NCCommunication
|
|
|
}
|
|
|
|
|
|
let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
|
|
|
- NCCommunication.sharedInstance.deleteFileOrFolder(serverUrlFileName, customUserAgent: nil, addCustomHeaders: addCustomHeaders, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.deleteFileOrFolder(serverUrlFileName, customUserAgent: nil, addCustomHeaders: addCustomHeaders, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 || errorCode == kOCErrorServerPathNotFound {
|
|
|
|
|
@@ -359,7 +359,7 @@ import NCCommunication
|
|
|
let fileName = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, activeUrl: url)!
|
|
|
let favorite = !metadata.favorite
|
|
|
|
|
|
- NCCommunication.sharedInstance.setFavorite(serverUrl: url, fileName: fileName, favorite: favorite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.setFavorite(serverUrl: url, fileName: fileName, favorite: favorite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 && metadata.account == account {
|
|
|
NCManageDatabase.sharedInstance.setMetadataFavorite(ocId: metadata.ocId, favorite: favorite)
|
|
@@ -427,7 +427,7 @@ import NCCommunication
|
|
|
let fileNamePath = metadata.serverUrl + "/" + metadata.fileName
|
|
|
let fileNameToPath = metadata.serverUrl + "/" + fileNameNew
|
|
|
|
|
|
- NCCommunication.sharedInstance.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 {
|
|
|
|
|
@@ -492,7 +492,7 @@ import NCCommunication
|
|
|
let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName
|
|
|
let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName
|
|
|
|
|
|
- NCCommunication.sharedInstance.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
var metadataNew = tableMetadata()
|
|
|
|
|
@@ -543,7 +543,7 @@ import NCCommunication
|
|
|
let serverUrlFileNameSource = metadata.serverUrl + "/" + metadata.fileName
|
|
|
let serverUrlFileNameDestination = serverUrlTo + "/" + metadata.fileName
|
|
|
|
|
|
- NCCommunication.sharedInstance.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
+ NCCommunication.shared.copyFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: overwrite, customUserAgent: nil, addCustomHeaders: nil, account: metadata.account) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
self.NotificationPost(name: k_notificationCenter_copyFile, userInfo: ["metadata": metadata, "errorCode": errorCode], errorDescription: errorDescription, completion: completion)
|
|
|
}
|