From d44f5c4f867d779c08cef3f57552f84381f51bf5 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 2 Apr 2024 18:19:01 +0800 Subject: [PATCH] Update suggestions on inputString change in sharee suggestions data source Signed-off-by: Claudio Cambra --- .../FileProviderUIExt/ShareeSuggestionsDataSource.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareeSuggestionsDataSource.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareeSuggestionsDataSource.swift index 5c84f5bd1..aa3f6388a 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareeSuggestionsDataSource.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderUIExt/ShareeSuggestionsDataSource.swift @@ -13,12 +13,19 @@ import SuggestionsTextFieldKit class ShareeSuggestionsDataSource: SuggestionsDataSource { let kit: NextcloudKit var suggestions: [SuggestionsTextFieldKit.Suggestion] = [] - var inputString: String = "" + var inputString: String = "" { + didSet { Task { await updateSuggestions() } } + } init(kit: NextcloudKit) { self.kit = kit } + private func updateSuggestions() async { + let sharees = await fetchSharees(search: inputString) + suggestions = suggestionsFromSharees(sharees) + } + private func fetchSharees(search: String) async -> [NKSharee] { return await withCheckedContinuation { continuation in kit.searchSharees( -- 2.30.2