diff --git a/app/src/main/java/eu/kanade/domain/source/model/SourceData.kt b/app/src/main/java/eu/kanade/domain/source/model/SourceData.kt index f9fcbf37f..44fe16d02 100644 --- a/app/src/main/java/eu/kanade/domain/source/model/SourceData.kt +++ b/app/src/main/java/eu/kanade/domain/source/model/SourceData.kt @@ -4,4 +4,7 @@ data class SourceData( val id: Long, val lang: String, val name: String, -) +) { + + val isMissingInfo: Boolean = name.isBlank() || lang.isBlank() +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt index 2f3dbbe3c..18e7fbeb1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt @@ -108,12 +108,12 @@ class SourceManager(private val context: Context) { @Suppress("OverridingDeprecatedMember") open inner class StubSource(val sourceData: SourceData) : Source { - override val name: String = sourceData.name + override val id: Long = sourceData.id + + override val name: String = sourceData.name.ifBlank { id.toString() } override val lang: String = sourceData.lang - override val id: Long = sourceData.id - override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo { throw getSourceNotInstalledException() } @@ -139,10 +139,7 @@ class SourceManager(private val context: Context) { } override fun toString(): String { - if (name.isNotBlank() && lang.isNotBlank()) { - return "$name (${lang.uppercase()})" - } - return id.toString() + return if (sourceData.isMissingInfo.not()) "$name (${lang.uppercase()})" else id.toString() } fun getSourceNotInstalledException(): SourceNotInstalledException {