Remove SourceData and use StubSource directly for database (#9429)

This commit is contained in:
Andreas
2023-05-03 16:33:05 +02:00
committed by GitHub
parent b328f0e344
commit f63573f25f
12 changed files with 81 additions and 97 deletions
@@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.extension.model
import android.graphics.drawable.Drawable
import eu.kanade.tachiyomi.source.Source
import tachiyomi.domain.source.model.SourceData
import tachiyomi.domain.source.model.StubSource
sealed class Extension {
@@ -44,10 +44,26 @@ sealed class Extension {
override val isNsfw: Boolean,
override val hasReadme: Boolean,
override val hasChangelog: Boolean,
val sources: List<AvailableSources>,
val sources: List<Source>,
val apkName: String,
val iconUrl: String,
) : Extension()
) : Extension() {
data class Source(
val id: Long,
val lang: String,
val name: String,
val baseUrl: String,
) {
fun toStubSource(): StubSource {
return StubSource(
id = this.id,
lang = this.lang,
name = this.name,
)
}
}
}
data class Untrusted(
override val name: String,
@@ -62,18 +78,3 @@ sealed class Extension {
override val hasChangelog: Boolean = false,
) : Extension()
}
data class AvailableSources(
val id: Long,
val lang: String,
val name: String,
val baseUrl: String,
) {
fun toSourceData(): SourceData {
return SourceData(
id = this.id,
lang = this.lang,
name = this.name,
)
}
}