Fix favorites sorting
This commit is contained in:
parent
7b86677fc2
commit
aae9762a8e
@ -118,6 +118,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
appRepository
|
appRepository
|
||||||
.search(query)
|
.search(query)
|
||||||
.withCustomLabels()
|
.withCustomLabels()
|
||||||
|
.sorted()
|
||||||
.collectLatest { apps ->
|
.collectLatest { apps ->
|
||||||
hiddenItemKeys.collectLatest { hiddenKeys ->
|
hiddenItemKeys.collectLatest { hiddenKeys ->
|
||||||
val results = apps.partition { !hiddenKeys.contains(it.key) }
|
val results = apps.partition { !hiddenKeys.contains(it.key) }
|
||||||
@ -132,6 +133,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
contactRepository
|
contactRepository
|
||||||
.search(query)
|
.search(query)
|
||||||
.withCustomLabels()
|
.withCustomLabels()
|
||||||
|
.sorted()
|
||||||
.collectLatest { contacts ->
|
.collectLatest { contacts ->
|
||||||
hiddenItemKeys.collectLatest { hiddenKeys ->
|
hiddenItemKeys.collectLatest { hiddenKeys ->
|
||||||
val results = contacts.partition { !hiddenKeys.contains(it.key) }
|
val results = contacts.partition { !hiddenKeys.contains(it.key) }
|
||||||
@ -146,6 +148,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
calendarRepository
|
calendarRepository
|
||||||
.search(query)
|
.search(query)
|
||||||
.withCustomLabels()
|
.withCustomLabels()
|
||||||
|
.sorted()
|
||||||
.collectLatest { events ->
|
.collectLatest { events ->
|
||||||
hiddenItemKeys.collectLatest { hiddenKeys ->
|
hiddenItemKeys.collectLatest { hiddenKeys ->
|
||||||
val results = events.partition { !hiddenKeys.contains(it.key) }
|
val results = events.partition { !hiddenKeys.contains(it.key) }
|
||||||
@ -180,6 +183,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
fileRepository
|
fileRepository
|
||||||
.search(query)
|
.search(query)
|
||||||
.withCustomLabels()
|
.withCustomLabels()
|
||||||
|
.sorted()
|
||||||
.collectLatest { files ->
|
.collectLatest { files ->
|
||||||
hiddenItemKeys.collectLatest { hiddenKeys ->
|
hiddenItemKeys.collectLatest { hiddenKeys ->
|
||||||
val results = files.partition { !hiddenKeys.contains(it.key) }
|
val results = files.partition { !hiddenKeys.contains(it.key) }
|
||||||
@ -199,6 +203,7 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
appShortcutRepository
|
appShortcutRepository
|
||||||
.search(query)
|
.search(query)
|
||||||
.withCustomLabels()
|
.withCustomLabels()
|
||||||
|
.sorted()
|
||||||
.collectLatest { shortcuts ->
|
.collectLatest { shortcuts ->
|
||||||
hiddenItemKeys.collectLatest { hidden ->
|
hiddenItemKeys.collectLatest { hidden ->
|
||||||
appShortcutResults.postValue(shortcuts.filter { !hidden.contains(it.key) })
|
appShortcutResults.postValue(shortcuts.filter { !hidden.contains(it.key) })
|
||||||
@ -303,11 +308,13 @@ class SearchVM : ViewModel(), KoinComponent {
|
|||||||
val customLabel = labels.find { it.key == item.key }
|
val customLabel = labels.find { it.key == item.key }
|
||||||
item.labelOverride = customLabel?.label
|
item.labelOverride = customLabel?.label
|
||||||
}
|
}
|
||||||
send(items.sorted())
|
send(items)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun <T: Searchable> Flow<List<T>>.sorted(): Flow<List<T>> = this.map { it.sorted() }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class HiddenItemResults(
|
private data class HiddenItemResults(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user