|
@@ -6,13 +6,14 @@ import kotlinx.coroutines.flow.Flow
|
|
import kotlinx.coroutines.flow.combine
|
|
import kotlinx.coroutines.flow.combine
|
|
import tachiyomi.domain.source.model.Source
|
|
import tachiyomi.domain.source.model.Source
|
|
import tachiyomi.domain.source.repository.SourceRepository
|
|
import tachiyomi.domain.source.repository.SourceRepository
|
|
|
|
+import java.util.SortedMap
|
|
|
|
|
|
class GetLanguagesWithSources(
|
|
class GetLanguagesWithSources(
|
|
private val repository: SourceRepository,
|
|
private val repository: SourceRepository,
|
|
private val preferences: SourcePreferences,
|
|
private val preferences: SourcePreferences,
|
|
) {
|
|
) {
|
|
|
|
|
|
- fun subscribe(): Flow<Map<String, List<Source>>> {
|
|
|
|
|
|
+ fun subscribe(): Flow<SortedMap<String, List<Source>>> {
|
|
return combine(
|
|
return combine(
|
|
preferences.enabledLanguages().changes(),
|
|
preferences.enabledLanguages().changes(),
|
|
preferences.disabledSources().changes(),
|
|
preferences.disabledSources().changes(),
|
|
@@ -23,7 +24,8 @@ class GetLanguagesWithSources(
|
|
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
|
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
|
|
)
|
|
)
|
|
|
|
|
|
- sortedSources.groupBy { it.lang }
|
|
|
|
|
|
+ sortedSources
|
|
|
|
+ .groupBy { it.lang }
|
|
.toSortedMap(
|
|
.toSortedMap(
|
|
compareBy<String> { it !in enabledLanguage }.then(LocaleHelper.comparator),
|
|
compareBy<String> { it !in enabledLanguage }.then(LocaleHelper.comparator),
|
|
)
|
|
)
|