From 2e7a4c435f9dc9c3b9a26ad3936ed206c7d161bc Mon Sep 17 00:00:00 2001 From: MM20 <15646950+MM2-0@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:11:45 +0200 Subject: [PATCH] Fix hidden items filter no longer working Close #965 --- .../mm20/launcher2/ui/launcher/search/SearchVM.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/SearchVM.kt b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/SearchVM.kt index c6ed1bb1..9f377063 100644 --- a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/SearchVM.kt +++ b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/SearchVM.kt @@ -45,6 +45,7 @@ import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.stateIn @@ -211,10 +212,14 @@ class SearchVM : ViewModel(), KoinComponent { searchJob = viewModelScope.launch { if (query.isEmpty()) { - val hiddenItemKeys = searchableRepository.getKeys( - maxVisibility = VisibilityLevel.SearchOnly, - includeTypes = listOf("app"), - ) + val hiddenItemKeys = if (!filters.hiddenItems) { + searchableRepository.getKeys( + maxVisibility = VisibilityLevel.SearchOnly, + includeTypes = listOf("app"), + ) + } else { + flowOf(emptyList()) + } val allApps = searchService.getAllApps() fileResults.value = emptyList() contactResults.value = emptyList()