|
@@ -36,6 +36,11 @@ extension FileProviderExtension {
|
|
|
let directoryName = NCUtility.shared.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.sharedInstance.account)
|
|
|
let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName
|
|
|
|
|
|
+ // NCCommunication
|
|
|
+ if fileProviderData.sharedInstance.setupAccount(domain: domain?.identifier.rawValue, providerExtension: self) == false {
|
|
|
+ completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
+ return
|
|
|
+ }
|
|
|
NCCommunication.shared.createFolder(serverUrlFileName) { (account, ocId, date, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 {
|
|
@@ -55,7 +60,7 @@ extension FileProviderExtension {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadataInsert, homeServerUrl: fileProviderData.sharedInstance.homeServerUrl) else {
|
|
|
+ guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadataInsert) else {
|
|
|
completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
return
|
|
|
}
|
|
@@ -87,6 +92,11 @@ extension FileProviderExtension {
|
|
|
let serverUrl = metadata.serverUrl;
|
|
|
let fileName = metadata.fileName;
|
|
|
|
|
|
+ // NCCommunication
|
|
|
+ if fileProviderData.sharedInstance.setupAccount(domain: domain?.identifier.rawValue, providerExtension: self) == false {
|
|
|
+ completionHandler(NSFileProviderError(.noSuchItem))
|
|
|
+ return
|
|
|
+ }
|
|
|
NCCommunication.shared.deleteFileOrFolder(serverUrlFileName) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 { //|| error == kOCErrorServerPathNotFound {
|
|
@@ -109,7 +119,7 @@ extension FileProviderExtension {
|
|
|
completionHandler(nil)
|
|
|
|
|
|
} else {
|
|
|
- completionHandler( NSFileProviderError(.serverUnreachable))
|
|
|
+ completionHandler(NSFileProviderError(.serverUnreachable))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -137,6 +147,11 @@ extension FileProviderExtension {
|
|
|
let serverUrlTo = tableDirectoryTo.serverUrl
|
|
|
let fileNameTo = serverUrlTo + "/" + itemFrom.filename
|
|
|
|
|
|
+ // NCCommunication
|
|
|
+ if fileProviderData.sharedInstance.setupAccount(domain: domain?.identifier.rawValue, providerExtension: self) == false {
|
|
|
+ completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
+ return
|
|
|
+ }
|
|
|
NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 {
|
|
@@ -179,6 +194,11 @@ extension FileProviderExtension {
|
|
|
let fileNamePathTo = metadata.serverUrl + "/" + itemName
|
|
|
let ocId = metadata.ocId
|
|
|
|
|
|
+ // NCCommunication
|
|
|
+ if fileProviderData.sharedInstance.setupAccount(domain: domain?.identifier.rawValue, providerExtension: self) == false {
|
|
|
+ completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
+ return
|
|
|
+ }
|
|
|
NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 {
|
|
@@ -209,7 +229,7 @@ extension FileProviderExtension {
|
|
|
NCManageDatabase.sharedInstance.setLocalFile(ocId: ocId, fileName: itemName, etag: nil)
|
|
|
}
|
|
|
|
|
|
- guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadata, homeServerUrl: fileProviderData.sharedInstance.homeServerUrl) else {
|
|
|
+ guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadata) else {
|
|
|
completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
return
|
|
|
}
|
|
@@ -246,6 +266,11 @@ extension FileProviderExtension {
|
|
|
if (favorite == true && metadata.favorite == false) || (favorite == false && metadata.favorite == true) {
|
|
|
let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: fileProviderData.sharedInstance.accountUrlBase, account: metadata.account)!
|
|
|
|
|
|
+ // NCCommunication
|
|
|
+ if fileProviderData.sharedInstance.setupAccount(domain: domain?.identifier.rawValue, providerExtension: self) == false {
|
|
|
+ completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
+ return
|
|
|
+ }
|
|
|
NCCommunication.shared.setFavorite(fileName: fileNamePath, favorite: favorite) { (account, errorCode, errorDescription) in
|
|
|
|
|
|
if errorCode == 0 {
|
|
@@ -303,7 +328,7 @@ extension FileProviderExtension {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadata, homeServerUrl: fileProviderData.sharedInstance.homeServerUrl) else {
|
|
|
+ guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadata) else {
|
|
|
completionHandler(nil, NSFileProviderError(.noSuchItem))
|
|
|
return
|
|
|
}
|