Fix favorite disable preference having no effect
This commit is contained in:
parent
f16e9c2b40
commit
79be655949
@ -57,6 +57,7 @@ fun SearchColumn(
|
|||||||
var showWorkProfileApps by remember { mutableStateOf(false) }
|
var showWorkProfileApps by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val hideFavs by viewModel.hideFavorites.observeAsState(true)
|
val hideFavs by viewModel.hideFavorites.observeAsState(true)
|
||||||
|
val favoritesEnabled by viewModel.favoritesEnabled.collectAsState(false)
|
||||||
val apps by viewModel.appResults.observeAsState(emptyList())
|
val apps by viewModel.appResults.observeAsState(emptyList())
|
||||||
val workApps by viewModel.workAppResults.observeAsState(emptyList())
|
val workApps by viewModel.workAppResults.observeAsState(emptyList())
|
||||||
val appShortcuts by viewModel.appShortcutResults.observeAsState(emptyList())
|
val appShortcuts by viewModel.appShortcutResults.observeAsState(emptyList())
|
||||||
@ -80,7 +81,7 @@ fun SearchColumn(
|
|||||||
contentPadding = paddingValues,
|
contentPadding = paddingValues,
|
||||||
reverseLayout = reverse,
|
reverseLayout = reverse,
|
||||||
) {
|
) {
|
||||||
if (!hideFavs) {
|
if (!hideFavs && favoritesEnabled) {
|
||||||
GridResults(
|
GridResults(
|
||||||
items = favorites.toImmutableList(),
|
items = favorites.toImmutableList(),
|
||||||
columns = columns,
|
columns = columns,
|
||||||
@ -101,7 +102,8 @@ fun SearchColumn(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.horizontalScroll(tagsScrollState).padding(end = 12.dp),
|
.horizontalScroll(tagsScrollState)
|
||||||
|
.padding(end = 12.dp),
|
||||||
) {
|
) {
|
||||||
FilterChip(
|
FilterChip(
|
||||||
modifier = Modifier.padding(start = 16.dp),
|
modifier = Modifier.padding(start = 16.dp),
|
||||||
|
|||||||
@ -66,6 +66,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
|
|
||||||
val hiddenResults = MutableLiveData<List<Searchable>>(emptyList())
|
val hiddenResults = MutableLiveData<List<Searchable>>(emptyList())
|
||||||
|
|
||||||
|
val favoritesEnabled = dataStore.data.map { it.favorites.enabled }
|
||||||
val hideFavorites = MutableLiveData(false)
|
val hideFavorites = MutableLiveData(false)
|
||||||
|
|
||||||
private val hiddenItemKeys = favoritesRepository
|
private val hiddenItemKeys = favoritesRepository
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user