Fix some MDLang issues

(cherry picked from commit c7bbad93b2e7d4114d0b1c20b172b0800b4a6286)
This commit is contained in:
Jobobby04 2024-06-26 17:25:26 -04:00 committed by Cuong-Tran
parent 688f11a3e5
commit 54bc3d883d
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2
3 changed files with 11 additions and 8 deletions

View file

@ -133,7 +133,10 @@ internal class ExtensionInstaller(private val context: Context) {
emit(downloadStatus)
// 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
}

View file

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

View file

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