From e8d1afa3df10004ae67f2f8a68deb1550a447380 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 15 Apr 2024 18:33:08 +0800 Subject: [PATCH] Adapt to new NextcloudFileProviderKit item nomenclature Signed-off-by: Claudio Cambra --- .../FileProviderExtension.swift | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift index 19d9f3ae9..5a404c7f7 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift @@ -116,25 +116,25 @@ import OSLog metadata.classFile = NKCommon.TypeClassFile.directory.rawValue completionHandler( - FileProviderItem( - metadata: metadata, - parentItemIdentifier: NSFileProviderItemIdentifier.rootContainer, - ncKit: ncKit), nil) + Item(metadata: metadata, parentItemIdentifier: .rootContainer, ncKit: ncKit), + nil + ) return Progress() } let dbManager = FilesDatabaseManager.shared guard let metadata = dbManager.itemMetadataFromFileProviderItemIdentifier(identifier), - let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata(metadata) + let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata(metadata) else { completionHandler(nil, NSFileProviderError(.noSuchItem)) return Progress() } completionHandler( - FileProviderItem( - metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit), nil) + Item(metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit), + nil + ) return Progress() } @@ -236,17 +236,18 @@ import OSLog dbManager.addLocalFileMetadataFromItemMetadata(updatedMetadata) dbManager.addItemMetadata(updatedMetadata) - guard - let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata( - updatedMetadata) - else { + guard let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata( + updatedMetadata + ) else { completionHandler(nil, nil, NSFileProviderError(.noSuchItem)) return } - let fpItem = FileProviderItem( - metadata: updatedMetadata, parentItemIdentifier: parentItemIdentifier, - ncKit: self.ncKit) + let fpItem = Item( + metadata: updatedMetadata, + parentItemIdentifier: parentItemIdentifier, + ncKit: self.ncKit + ) completionHandler(fileNameLocalPath, fpItem, nil) } else { @@ -378,10 +379,11 @@ import OSLog dbManager.addItemMetadata(directoryMetadata) - let fpItem = FileProviderItem( + let fpItem = Item( metadata: directoryMetadata, parentItemIdentifier: parentItemIdentifier, - ncKit: self.ncKit) + ncKit: self.ncKit + ) completionHandler(fpItem, [], true, nil) } @@ -446,7 +448,7 @@ import OSLog dbManager.addLocalFileMetadataFromItemMetadata(newMetadata) dbManager.addItemMetadata(newMetadata) - let fpItem = FileProviderItem( + let fpItem = Item( metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, ncKit: self.ncKit ) @@ -586,8 +588,8 @@ import OSLog return } - modifiedItem = FileProviderItem( - metadata: newMetadata, + modifiedItem = Item( + metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, ncKit: self.ncKit ) @@ -707,8 +709,9 @@ import OSLog dbManager.addLocalFileMetadataFromItemMetadata(newMetadata) dbManager.addItemMetadata(newMetadata) - modifiedItem = FileProviderItem( - metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, + modifiedItem = Item( + metadata: newMetadata, + parentItemIdentifier: parentItemIdentifier, ncKit: self.ncKit ) completionHandler(modifiedItem, [], false, nil)