Add share fetching routine to FPUIExtensionService

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-02-27 20:29:46 +08:00
parent af93122445
commit 6dad778498
2 changed files with 12 additions and 2 deletions

View file

@ -5,12 +5,13 @@
// Created by Claudio Cambra on 21/2/24.
//
import Foundation
import FileProvider
import NextcloudKit
let fpUiExtensionServiceName = NSFileProviderServiceName(
"com.nextcloud.desktopclient.FPUIExtensionService"
)
@objc protocol FPUIExtensionService {
func shares(forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier) async -> [NKShare]?
}

View file

@ -7,6 +7,7 @@
import FileProvider
import Foundation
import NextcloudKit
import OSLog
class FPUIExtensionServiceSource: NSObject, NSFileProviderServiceSource, NSXPCListenerDelegate, FPUIExtensionService {
@ -38,4 +39,12 @@ class FPUIExtensionServiceSource: NSObject, NSFileProviderServiceSource, NSXPCLi
//MARK: - FPUIExtensionService protocol methods
func shares(
forItemIdentifier itemIdentifier: NSFileProviderItemIdentifier
) async -> [NKShare]? {
let controller = ItemSharesController(
itemIdentifier: itemIdentifier, parentExtension: fpExtension
)
return await controller.fetch()
}
}