Adapt to new NextcloudFileProviderKit item nomenclature

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-04-15 18:33:08 +08:00
parent 913d724254
commit e8d1afa3df
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -116,25 +116,25 @@ import OSLog
metadata.classFile = NKCommon.TypeClassFile.directory.rawValue metadata.classFile = NKCommon.TypeClassFile.directory.rawValue
completionHandler( completionHandler(
FileProviderItem( Item(metadata: metadata, parentItemIdentifier: .rootContainer, ncKit: ncKit),
metadata: metadata, nil
parentItemIdentifier: NSFileProviderItemIdentifier.rootContainer, )
ncKit: ncKit), nil)
return Progress() return Progress()
} }
let dbManager = FilesDatabaseManager.shared let dbManager = FilesDatabaseManager.shared
guard let metadata = dbManager.itemMetadataFromFileProviderItemIdentifier(identifier), guard let metadata = dbManager.itemMetadataFromFileProviderItemIdentifier(identifier),
let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata(metadata) let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata(metadata)
else { else {
completionHandler(nil, NSFileProviderError(.noSuchItem)) completionHandler(nil, NSFileProviderError(.noSuchItem))
return Progress() return Progress()
} }
completionHandler( completionHandler(
FileProviderItem( Item(metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit),
metadata: metadata, parentItemIdentifier: parentItemIdentifier, ncKit: ncKit), nil) nil
)
return Progress() return Progress()
} }
@ -236,17 +236,18 @@ import OSLog
dbManager.addLocalFileMetadataFromItemMetadata(updatedMetadata) dbManager.addLocalFileMetadataFromItemMetadata(updatedMetadata)
dbManager.addItemMetadata(updatedMetadata) dbManager.addItemMetadata(updatedMetadata)
guard guard let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata(
let parentItemIdentifier = dbManager.parentItemIdentifierFromMetadata( updatedMetadata
updatedMetadata) ) else {
else {
completionHandler(nil, nil, NSFileProviderError(.noSuchItem)) completionHandler(nil, nil, NSFileProviderError(.noSuchItem))
return return
} }
let fpItem = FileProviderItem( let fpItem = Item(
metadata: updatedMetadata, parentItemIdentifier: parentItemIdentifier, metadata: updatedMetadata,
ncKit: self.ncKit) parentItemIdentifier: parentItemIdentifier,
ncKit: self.ncKit
)
completionHandler(fileNameLocalPath, fpItem, nil) completionHandler(fileNameLocalPath, fpItem, nil)
} else { } else {
@ -378,10 +379,11 @@ import OSLog
dbManager.addItemMetadata(directoryMetadata) dbManager.addItemMetadata(directoryMetadata)
let fpItem = FileProviderItem( let fpItem = Item(
metadata: directoryMetadata, metadata: directoryMetadata,
parentItemIdentifier: parentItemIdentifier, parentItemIdentifier: parentItemIdentifier,
ncKit: self.ncKit) ncKit: self.ncKit
)
completionHandler(fpItem, [], true, nil) completionHandler(fpItem, [], true, nil)
} }
@ -446,7 +448,7 @@ import OSLog
dbManager.addLocalFileMetadataFromItemMetadata(newMetadata) dbManager.addLocalFileMetadataFromItemMetadata(newMetadata)
dbManager.addItemMetadata(newMetadata) dbManager.addItemMetadata(newMetadata)
let fpItem = FileProviderItem( let fpItem = Item(
metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, ncKit: self.ncKit metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, ncKit: self.ncKit
) )
@ -586,7 +588,7 @@ import OSLog
return return
} }
modifiedItem = FileProviderItem( modifiedItem = Item(
metadata: newMetadata, metadata: newMetadata,
parentItemIdentifier: parentItemIdentifier, parentItemIdentifier: parentItemIdentifier,
ncKit: self.ncKit ncKit: self.ncKit
@ -707,8 +709,9 @@ import OSLog
dbManager.addLocalFileMetadataFromItemMetadata(newMetadata) dbManager.addLocalFileMetadataFromItemMetadata(newMetadata)
dbManager.addItemMetadata(newMetadata) dbManager.addItemMetadata(newMetadata)
modifiedItem = FileProviderItem( modifiedItem = Item(
metadata: newMetadata, parentItemIdentifier: parentItemIdentifier, metadata: newMetadata,
parentItemIdentifier: parentItemIdentifier,
ncKit: self.ncKit ncKit: self.ncKit
) )
completionHandler(modifiedItem, [], false, nil) completionHandler(modifiedItem, [], false, nil)