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>
Cette révision appartient à :
Parent
4684797dfb
révision
902bb35ba7
2 fichiers modifiés avec 8 ajouts et 8 suppressions
|
@ -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 {
|
||||
|
|
Référencer dans un nouveau ticket