Implement NSFileProviderServicing in FileProviderExtension

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-01-02 14:12:49 +08:00
Родитель 6f5b07c1ae
Коммит 5ed456f30c
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -18,7 +18,23 @@ import NCDesktopClientSocketKit
import NextcloudKit
import OSLog
extension FileProviderExtension {
extension FileProviderExtension: NSFileProviderServicing {
func supportedServiceSources(
for itemIdentifier: NSFileProviderItemIdentifier,
completionHandler: @escaping ([NSFileProviderServiceSource]?, Error?) -> Void
) -> Progress {
Logger.desktopClientConnection.debug("Serving supported service sources")
let clientCommService = ClientCommunicationService(fpExtension: self)
let services = [clientCommService]
completionHandler(services, nil)
let progress = Progress()
progress.cancellationHandler = {
let error = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError)
completionHandler(nil, error)
}
return progress
}
@objc func sendFileProviderDomainIdentifier() {
let command = "FILE_PROVIDER_DOMAIN_IDENTIFIER_REQUEST_REPLY"
let argument = domain.identifier.rawValue