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
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,7 +588,7 @@ import OSLog
return
}
modifiedItem = FileProviderItem(
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)