Fix private space apps being assigned to main profile when private space is locked

This commit is contained in:
MM20 2024-10-12 11:23:02 +02:00
parent 02ce5b3f61
commit 309f254878
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -1,5 +1,6 @@
package de.mm20.launcher2.search
import android.util.Log
import de.mm20.launcher2.calculator.CalculatorRepository
import de.mm20.launcher2.data.customattrs.CustomAttributesRepository
import de.mm20.launcher2.data.customattrs.utils.withCustomLabels
@ -253,7 +254,7 @@ internal class SearchServiceImpl(
}
override fun getAllApps(): Flow<AllAppsResults> {
return profileManager.activeProfiles.flatMapLatest { profiles ->
return profileManager.profiles.flatMapLatest { profiles ->
val standardProfile = profiles.find { it.type == Profile.Type.Personal }
val workProfile = profiles.find { it.type == Profile.Type.Work }
val privateSpace = profiles.find { it.type == Profile.Type.Private }
@ -268,7 +269,9 @@ internal class SearchServiceImpl(
standardProfile != null && app.user == standardProfile.userHandle -> standardProfileApps.add(app)
workProfile != null && app.user == workProfile.userHandle -> workProfileApps.add(app)
privateSpace != null && app.user == privateSpace.userHandle -> privateSpaceApps.add(app)
else -> standardProfileApps.add(app)
else -> {
Log.w("MM20", "App ${app.label} does not belong to any known profile. Ignoring.")
}
}
}