mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 20:19:05 +01:00
Minor cleanup in ImageUtil and SourceFilterPresenter (#7106)
* Minor cleanup in `ImageUtil` and `SourceFilterPresenter` * Fix missed stuff
This commit is contained in:
@@ -33,15 +33,12 @@ class SourceFilterPresenter(
|
||||
.catch { exception ->
|
||||
_state.value = SourceFilterState.Error(exception)
|
||||
}
|
||||
.collectLatest { sourceLangMap ->
|
||||
val uiModels = sourceLangMap.toFilterUiModels()
|
||||
_state.value = SourceFilterState.Success(uiModels)
|
||||
}
|
||||
.collectLatest(::collectLatestSourceLangMap)
|
||||
}
|
||||
}
|
||||
|
||||
private fun Map<String, List<Source>>.toFilterUiModels(): List<FilterUiModel> {
|
||||
return this.flatMap {
|
||||
private fun collectLatestSourceLangMap(sourceLangMap: Map<String, List<Source>>) {
|
||||
val uiModels = sourceLangMap.flatMap {
|
||||
val isLangEnabled = it.key in preferences.enabledLanguages().get()
|
||||
val header = listOf(FilterUiModel.Header(it.key, isLangEnabled))
|
||||
|
||||
@@ -53,6 +50,7 @@ class SourceFilterPresenter(
|
||||
)
|
||||
}
|
||||
}
|
||||
_state.value = SourceFilterState.Success(uiModels)
|
||||
}
|
||||
|
||||
fun toggleSource(source: Source) {
|
||||
|
||||
Reference in New Issue
Block a user