diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift index bd4c5b33f..c4bcfd145 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift @@ -111,6 +111,9 @@ import OSLog request: NSFileProviderRequest, completionHandler: @escaping (URL?, NSFileProviderItem?, Error?) -> Void ) -> Progress { + let actionId = UUID() + insertSyncAction(actionId) + Logger.fileProviderExtension.debug( "Received request to fetch contents of item with identifier: \(itemIdentifier.rawValue, privacy: .public)" ) @@ -120,6 +123,7 @@ import OSLog Logger.fileProviderExtension.error( "Can't return contents for a specific version as this is not supported." ) + insertErrorAction(actionId) completionHandler( nil, nil, @@ -135,6 +139,7 @@ import OSLog as account not set up yet. """ ) + insertErrorAction(actionId) completionHandler(nil, nil, NSFileProviderError(.notAuthenticated)) return Progress() } @@ -147,6 +152,7 @@ import OSLog """ ) completionHandler(nil, nil, NSFileProviderError(.noSuchItem)) + insertErrorAction(actionId) return Progress() } @@ -155,6 +161,7 @@ import OSLog let (localUrl, updatedItem, error) = await item.fetchContents( domain: self.domain, progress: progress ) + removeSyncAction(actionId) completionHandler(localUrl, updatedItem, error) } return progress @@ -170,6 +177,8 @@ import OSLog NSFileProviderItem?, NSFileProviderItemFields, Bool, Error? ) -> Void ) -> Progress { + let actionId = UUID() + insertSyncAction(actionId) let tempId = itemTemplate.itemIdentifier.rawValue Logger.fileProviderExtension.debug( @@ -186,6 +195,7 @@ import OSLog as account not set up yet """ ) + insertErrorAction(actionId) completionHandler( itemTemplate, NSFileProviderItemFields(), @@ -207,9 +217,14 @@ import OSLog ncAccount: ncAccount, progress: progress ) + if error != nil { + insertErrorAction(actionId) signalEnumerator(completionHandler: { _ in }) + } else { + removeSyncAction(actionId) } + completionHandler( item ?? itemTemplate, NSFileProviderItemFields(), @@ -233,6 +248,8 @@ import OSLog ) -> Progress { // An item was modified on disk, process the item's modification // TODO: Handle finder things like tags, other possible item changed fields + let actionId = UUID() + insertSyncAction(actionId) let identifier = item.itemIdentifier let ocId = identifier.rawValue @@ -247,6 +264,7 @@ import OSLog Logger.fileProviderExtension.error( "Not modifying item: \(ocId, privacy: .public) as account not set up yet." ) + insertErrorAction(actionId) completionHandler(item, [], false, NSFileProviderError(.notAuthenticated)) return Progress() } @@ -255,6 +273,7 @@ import OSLog Logger.fileProviderExtension.error( "Not modifying item: \(ocId, privacy: .public) as item not found." ) + insertErrorAction(actionId) completionHandler(item, [], false, NSFileProviderError(.noSuchItem)) return Progress() } @@ -272,9 +291,14 @@ import OSLog domain: domain, progress: progress ) + if error != nil { + insertErrorAction(actionId) signalEnumerator(completionHandler: { _ in }) + } else { + removeSyncAction(actionId) } + completionHandler(modifiedItem ?? item, [], false, error) } return progress @@ -287,6 +311,9 @@ import OSLog request _: NSFileProviderRequest, completionHandler: @escaping (Error?) -> Void ) -> Progress { + let actionId = UUID() + insertSyncAction(actionId) + Logger.fileProviderExtension.debug( "Received delete request for item: \(identifier.rawValue, privacy: .public)" ) @@ -295,6 +322,7 @@ import OSLog Logger.fileProviderExtension.error( "Not deleting item \(identifier.rawValue, privacy: .public), account not set up yet" ) + insertErrorAction(actionId) completionHandler(NSFileProviderError(.notAuthenticated)) return Progress() } @@ -303,6 +331,7 @@ import OSLog Logger.fileProviderExtension.error( "Not deleting item \(identifier.rawValue, privacy: .public), item not found" ) + insertErrorAction(actionId) completionHandler(NSFileProviderError(.noSuchItem)) return Progress() } @@ -311,7 +340,10 @@ import OSLog Task { let error = await item.delete() if error != nil { + insertErrorAction(actionId) signalEnumerator(completionHandler: { _ in }) + } else { + removeSyncAction(actionId) } progress.completedUnitCount = 1 completionHandler(await item.delete())