зеркало из https://github.com/nextcloud/desktop.git
Implement eviction capabilities in FileProviderItem
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
3e5766be47
Коммит
60f116cdd4
|
@ -32,13 +32,25 @@ class FileProviderItem: NSObject, NSFileProviderItem {
|
|||
|
||||
var capabilities: NSFileProviderItemCapabilities {
|
||||
guard !metadata.directory else {
|
||||
return [
|
||||
.allowsAddingSubItems,
|
||||
.allowsContentEnumerating,
|
||||
.allowsReading,
|
||||
.allowsDeleting,
|
||||
.allowsRenaming,
|
||||
]
|
||||
if #available(macOS 13.0, *) {
|
||||
// .allowsEvicting deprecated on macOS 13.0+, use contentPolicy instead
|
||||
return [
|
||||
.allowsAddingSubItems,
|
||||
.allowsContentEnumerating,
|
||||
.allowsReading,
|
||||
.allowsDeleting,
|
||||
.allowsRenaming
|
||||
]
|
||||
} else {
|
||||
return [
|
||||
.allowsAddingSubItems,
|
||||
.allowsContentEnumerating,
|
||||
.allowsReading,
|
||||
.allowsDeleting,
|
||||
.allowsRenaming,
|
||||
.allowsEvicting
|
||||
]
|
||||
}
|
||||
}
|
||||
guard !metadata.lock else {
|
||||
return [.allowsReading]
|
||||
|
@ -49,6 +61,7 @@ class FileProviderItem: NSObject, NSFileProviderItem {
|
|||
.allowsDeleting,
|
||||
.allowsRenaming,
|
||||
.allowsReparenting,
|
||||
.allowsEvicting
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -133,6 +146,11 @@ class FileProviderItem: NSObject, NSFileProviderItem {
|
|||
}
|
||||
}
|
||||
|
||||
@available(macOSApplicationExtension 13.0, *)
|
||||
var contentPolicy: NSFileProviderContentPolicy {
|
||||
.downloadLazily
|
||||
}
|
||||
|
||||
required init(
|
||||
metadata: NextcloudItemMetadataTable,
|
||||
parentItemIdentifier: NSFileProviderItemIdentifier,
|
||||
|
|
Загрузка…
Ссылка в новой задаче