From 1f6664c62df325893fab042f3f6a1473a760d3b6 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Wed, 18 Sep 2024 22:30:14 +0200 Subject: [PATCH] Don't show ourselves in the "all apps" tab --- .../kotlin/nl/ndat/tvlauncher/ui/tab/apps/AppsTabViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/kotlin/nl/ndat/tvlauncher/ui/tab/apps/AppsTabViewModel.kt b/app/src/main/kotlin/nl/ndat/tvlauncher/ui/tab/apps/AppsTabViewModel.kt index b191042..5a1d027 100644 --- a/app/src/main/kotlin/nl/ndat/tvlauncher/ui/tab/apps/AppsTabViewModel.kt +++ b/app/src/main/kotlin/nl/ndat/tvlauncher/ui/tab/apps/AppsTabViewModel.kt @@ -3,7 +3,9 @@ package nl.ndat.tvlauncher.ui.tab.apps import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn +import nl.ndat.tvlauncher.BuildConfig import nl.ndat.tvlauncher.data.repository.AppRepository import nl.ndat.tvlauncher.data.sqldelight.App @@ -11,6 +13,8 @@ class AppsTabViewModel( private val appRepository: AppRepository, ) : ViewModel() { val apps = appRepository.getApps() + // Hide launcher app from showing + .map { apps -> apps.filterNot { app -> app.packageName == BuildConfig.APPLICATION_ID } } .stateIn(viewModelScope, SharingStarted.Eagerly, emptyList()) fun favoriteApp(app: App, favorite: Boolean) {