making 'inProgress' of LocalFileProvider work

This commit is contained in:
Hans van Dam
2017-04-17 18:16:04 +02:00
parent 02e6cd37dd
commit 61ba245189
2 changed files with 9 additions and 8 deletions
+6 -4
View File
@@ -259,7 +259,8 @@ open class LocalFileProvider: FileProvider, FileProviderMonitor, FileProvideUndo
@discardableResult
fileprivate func doOperation(_ opType: FileOperationType, data: Data? = nil, atomically: Bool = false, forUploading: Bool = false, completionHandler: SimpleCompletionHandler) -> OperationHandle? {
let localOperationHandle = LocalOperationHandle(operationType: opType, baseURL: self.baseURL)
func urlofpath(path: String) -> URL {
if path.hasPrefix("file://") {
let removedSchemePath = path.replacingOccurrences(of: "file://", with: "", options: .anchored)
@@ -293,6 +294,7 @@ open class LocalFileProvider: FileProvider, FileProviderMonitor, FileProvideUndo
let operationHandler: (URL, URL?) -> Void = { source, dest in
do {
localOperationHandle.inProgress = true
switch opType {
case .create:
if sourcePath.hasSuffix("/") {
@@ -316,7 +318,8 @@ open class LocalFileProvider: FileProvider, FileProviderMonitor, FileProvideUndo
if successfulSecurityScopedResourceAccess {
source.stopAccessingSecurityScopedResource()
}
localOperationHandle.inProgress = false
self.dispatch_queue.async {
completionHandler?(nil)
}
@@ -368,8 +371,7 @@ open class LocalFileProvider: FileProvider, FileProviderMonitor, FileProvideUndo
operationHandler(source, dest)
}
}
return LocalOperationHandle(operationType: opType, baseURL: self.baseURL)
return localOperationHandle
}
@discardableResult
+3 -4
View File
@@ -280,10 +280,9 @@ open class LocalOperationHandle: OperationHandle {
}
/// Not usable in local provider
open var inProgress: Bool {
return false
}
open var inProgress: Bool = false
/// Not usable in local provider
open func cancel() -> Bool{
return false