- PinnableSearchable -> SavableSearchable,
- FavoritesItem -> SavedSearchable,
- FavoritesItemEntity -> SavedSearchableEntity

add type column to searchable table
This commit is contained in:
MM20
2022-10-16 15:53:22 +02:00
parent 7e6a4466ca
commit f88f71e5ee
61 changed files with 717 additions and 295 deletions
@@ -36,7 +36,6 @@ import de.mm20.launcher2.wikipedia.WikipediaRepository
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.channelFlow
@@ -216,7 +215,7 @@ internal class SearchServiceImpl(
}
launch {
results
.map { it.toList().sortedBy { it as? PinnableSearchable }.toImmutableList() }
.map { it.toList().sortedBy { it as? SavableSearchable }.toImmutableList() }
.collectLatest {
send(it)
}
@@ -235,7 +234,7 @@ internal data class SearchResults(
val unitConverters: List<UnitConverter> = emptyList(),
val websites: List<Website> = emptyList(),
val wikipedia: List<Wikipedia> = emptyList(),
val other: List<PinnableSearchable> = emptyList(),
val other: List<SavableSearchable> = emptyList(),
) {
fun toList(): List<Searchable> {
return (apps + shortcuts + contacts + calendars + websites + wikipedia + other).distinctBy { it.key } + calculators+ unitConverters