Revert "Filter private space apps from favorites while hidden"

This reverts commit 75f69747ce9d52fcd29997d7b2718357852c0c76.
This commit is contained in:
MM20
2026-07-04 15:58:05 +02:00
parent db051292be
commit 89fac566e9
4 changed files with 9 additions and 29 deletions

View File

@@ -72,11 +72,6 @@ class ProfileManager(
it.mapNotNull { it?.profile }
}.shareIn(scope, SharingStarted.WhileSubscribed(), replay = 1)
val hiddenPrivateSpaceUser: Flow<UserHandle?> = profileStates.map { profiles ->
val private = profiles[2]
if (private?.state?.hidden == true) private.profile.userHandle else null
}.shareIn(scope, SharingStarted.WhileSubscribed(), replay = 1)
init {
val receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {

View File

@@ -47,7 +47,6 @@ dependencies {
implementation(project(":core:base"))
implementation(project(":core:i18n"))
implementation(project(":core:profiles"))
implementation(project(":data:searchable"))
}

View File

@@ -1,18 +1,13 @@
package de.mm20.launcher2.services.favorites
import de.mm20.launcher2.profiles.ProfileManager
import de.mm20.launcher2.search.Application
import de.mm20.launcher2.search.SavableSearchable
import de.mm20.launcher2.searchable.PinnedLevel
import de.mm20.launcher2.searchable.SavableSearchableRepository
import de.mm20.launcher2.searchable.VisibilityLevel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
class FavoritesService(
private val searchableRepository: SavableSearchableRepository,
private val profileManager: ProfileManager,
) {
fun getFavorites(
includeTypes: List<String>? = null,
@@ -21,23 +16,14 @@ class FavoritesService(
maxPinnedLevel: PinnedLevel = PinnedLevel.ManuallySorted,
limit: Int = 100,
): Flow<List<SavableSearchable>> {
return profileManager.activeProfiles.flatMapLatest {
combine(
searchableRepository.get(
return searchableRepository.get(
includeTypes = includeTypes,
excludeTypes = excludeTypes,
minPinnedLevel = minPinnedLevel,
maxPinnedLevel = maxPinnedLevel,
limit = Int.MAX_VALUE,
limit = limit,
minVisibility = VisibilityLevel.SearchOnly,
),
profileManager.hiddenPrivateSpaceUser,
) { items, hiddenUser ->
val filtered = if (hiddenUser == null) items
else items.filter { it !is Application || it.user != hiddenUser }
filtered.take(limit)
}
}
)
}
fun isPinned(searchable: SavableSearchable): Flow<Boolean> {

View File

@@ -3,5 +3,5 @@ package de.mm20.launcher2.services.favorites
import org.koin.dsl.module
val favoritesModule = module {
factory { FavoritesService(get(), get()) }
factory { FavoritesService(get()) }
}