mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Little cleanup for stub source (#7519)
* Little cleanup for stub source Fixes instances where name shows up blank for stub sources * Review Changes Co-authored-by: Andreas <andreas.everos@gmail.com> Co-authored-by: Andreas <andreas.everos@gmail.com>
This commit is contained in:
parent
4684797dfb
commit
902bb35ba7
2 changed files with 8 additions and 8 deletions
|
@ -4,4 +4,7 @@ data class SourceData(
|
|||
val id: Long,
|
||||
val lang: String,
|
||||
val name: String,
|
||||
)
|
||||
) {
|
||||
|
||||
val isMissingInfo: Boolean = name.isBlank() || lang.isBlank()
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue