From 8ae728a57b79d6d255500bd24bc7e426ee19f60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaquim=20St=C3=A4hli?= Date: Thu, 2 Nov 2023 13:32:36 +0100 Subject: [PATCH] Effectively don't trigger search when query <3 --- .../pillarbox/demo/ui/integrationLayer/SearchViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/integrationLayer/SearchViewModel.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/integrationLayer/SearchViewModel.kt index 92be55918..c0320fa5a 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/integrationLayer/SearchViewModel.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/integrationLayer/SearchViewModel.kt @@ -53,7 +53,7 @@ class SearchViewModel(private val ilRepository: ILRepository) : ViewModel() { */ @OptIn(ExperimentalCoroutinesApi::class) val result: Flow> = config.flatMapLatest { config -> - if (config.query.isNotBlank() || config.query.length >= 3) { + if (config.query.length >= 3) { ilRepository.search(config.bu, config.query).map { mediaPagingData -> val pagingData: PagingData = mediaPagingData.map { item -> SearchContent.MediaResult(Content.Media(item)) } pagingData.insertHeaderItem(item = SearchContent.BuSelector)