mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Bug fixes in modules fragment
- Progress is not updated in upgradable modules (and can cause crash) - EndlessRecyclerScrollListener is not reset on new query
This commit is contained in:
parent
01a43b03bd
commit
dc8f0f6feb
@ -256,6 +256,7 @@ class ModuleViewModel(
|
||||
}
|
||||
|
||||
override fun query() {
|
||||
EndlessRecyclerScrollListener.ResetState().publish()
|
||||
queryJob = viewModelScope.launch {
|
||||
val searched = queryInternal(query, 0)
|
||||
val diff = withContext(Dispatchers.Default) {
|
||||
@ -277,10 +278,13 @@ class ModuleViewModel(
|
||||
// ---
|
||||
|
||||
private fun update(repo: Repo, progress: Int) = viewModelScope.launch {
|
||||
val item = withContext(Dispatchers.Default) {
|
||||
(itemsRemote + itemsSearch).first { it.item.id == repo.id }
|
||||
val items = withContext(Dispatchers.Default) {
|
||||
val predicate = { it: RepoItem -> it.item.id == repo.id }
|
||||
itemsUpdatable.filter(predicate) +
|
||||
itemsRemote.filter(predicate) +
|
||||
itemsSearch.filter(predicate)
|
||||
}
|
||||
item.progress.value = progress
|
||||
items.forEach { it.progress.value = progress }
|
||||
}
|
||||
|
||||
// ---
|
||||
|
Loading…
Reference in New Issue
Block a user