Add sharee fetcher method to shareesuggestionsdatasource

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-04-02 18:17:35 +08:00
parent 74cea5e57a
commit 3012976d9b
2 changed files with 20 additions and 0 deletions

View file

@ -13,6 +13,7 @@ extension Logger {
static let actionViewController = Logger(subsystem: subsystem, category: "actionViewController")
static let shareCapabilities = Logger(subsystem: subsystem, category: "shareCapabilities")
static let shareController = Logger(subsystem: subsystem, category: "shareController")
static let shareeDataSource = Logger(subsystem: subsystem, category: "shareeDataSource")
static let sharesDataSource = Logger(subsystem: subsystem, category: "sharesDataSource")
static let shareOptionsView = Logger(subsystem: subsystem, category: "shareOptionsView")
static let shareViewController = Logger(subsystem: subsystem, category: "shareViewController")

View file

@ -18,4 +18,23 @@ class ShareeSuggestionsDataSource: SuggestionsDataSource {
init(kit: NextcloudKit) {
self.kit = kit
}
private func fetchSharees(search: String) async -> [NKSharee] {
return await withCheckedContinuation { continuation in
kit.searchSharees(
search: inputString,
page: 1,
perPage: 20,
completion: { account, sharees, data, error in
defer { continuation.resume(returning: sharees ?? []) }
guard error == .success else {
Logger.shareeDataSource.error(
"Error fetching sharees: \(error.description, privacy: .public)"
)
return
}
}
)
}
}
}