Fix some MDLang issues

This commit is contained in:
Jobobby04 2024-06-26 17:25:26 -04:00
parent 1a4a2506f4
commit c7bbad93b2
3 changed files with 11 additions and 8 deletions

View File

@ -133,7 +133,10 @@ internal class ExtensionInstaller(private val context: Context) {
emit(downloadStatus) emit(downloadStatus)
// Stop polling when the download fails or finishes // Stop polling when the download fails or finishes
if (downloadStatus == DownloadManager.STATUS_SUCCESSFUL || downloadStatus == DownloadManager.STATUS_FAILED) { if (
downloadStatus == DownloadManager.STATUS_SUCCESSFUL ||
downloadStatus == DownloadManager.STATUS_FAILED
) {
return@flow return@flow
} }

View File

@ -53,6 +53,9 @@ class AndroidSourceManager(
private val sourceRepository: StubSourceRepository, private val sourceRepository: StubSourceRepository,
) : SourceManager { ) : SourceManager {
private val _isInitialized = MutableStateFlow(false)
override val isInitialized: StateFlow<Boolean> = _isInitialized.asStateFlow()
private val downloadManager: DownloadManager by injectLazy() private val downloadManager: DownloadManager by injectLazy()
private val scope = CoroutineScope(Job() + Dispatchers.IO) private val scope = CoroutineScope(Job() + Dispatchers.IO)
@ -189,9 +192,6 @@ class AndroidSourceManager(
} }
// SY --> // SY -->
private val _isInitialized = MutableStateFlow(false)
override val isInitialized: StateFlow<Boolean> = _isInitialized.asStateFlow()
override fun getVisibleOnlineSources() = sourcesMapFlow.value.values override fun getVisibleOnlineSources() = sourcesMapFlow.value.values
.filterIsInstance<HttpSource>() .filterIsInstance<HttpSource>()
.filter { .filter {

View File

@ -5,7 +5,7 @@ enum class MdLang(val lang: String, val extLang: String = lang) {
ENGLISH("en"), ENGLISH("en"),
JAPANESE("ja"), JAPANESE("ja"),
POLISH("pl"), POLISH("pl"),
SERBO_CROATIAN("rs", "sh"), SERBIAN("sh"),
DUTCH("nl"), DUTCH("nl"),
ITALIAN("it"), ITALIAN("it"),
RUSSIAN("ru"), RUSSIAN("ru"),
@ -29,7 +29,7 @@ enum class MdLang(val lang: String, val extLang: String = lang) {
MONGOLIAN("mn"), MONGOLIAN("mn"),
TURKISH("tr"), TURKISH("tr"),
INDONESIAN("id"), INDONESIAN("id"),
KOREAN("kr", "ko"), KOREAN("ko"),
SPANISH_LATAM("es-la", "es-419"), SPANISH_LATAM("es-la", "es-419"),
PERSIAN("fa"), PERSIAN("fa"),
MALAY("ms"), MALAY("ms"),
@ -51,12 +51,12 @@ enum class MdLang(val lang: String, val extLang: String = lang) {
companion object { companion object {
fun fromIsoCode(isoCode: String): MdLang? = fun fromIsoCode(isoCode: String): MdLang? =
values().firstOrNull { entries.firstOrNull {
it.lang == isoCode it.lang == isoCode
} }
fun fromExt(extLang: String): MdLang? = fun fromExt(extLang: String): MdLang? =
values().firstOrNull { entries.firstOrNull {
it.extLang == extLang it.extLang == extLang
} }
} }