Extension.kt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package eu.kanade.tachiyomi.extension.model
  2. import android.graphics.drawable.Drawable
  3. import eu.kanade.tachiyomi.source.Source
  4. import tachiyomi.domain.source.model.StubSource
  5. sealed class Extension {
  6. abstract val name: String
  7. abstract val pkgName: String
  8. abstract val versionName: String
  9. abstract val versionCode: Long
  10. abstract val libVersion: Double
  11. abstract val lang: String?
  12. abstract val isNsfw: Boolean
  13. data class Installed(
  14. override val name: String,
  15. override val pkgName: String,
  16. override val versionName: String,
  17. override val versionCode: Long,
  18. override val libVersion: Double,
  19. override val lang: String,
  20. override val isNsfw: Boolean,
  21. val pkgFactory: String?,
  22. val sources: List<Source>,
  23. val icon: Drawable?,
  24. val hasUpdate: Boolean = false,
  25. val isObsolete: Boolean = false,
  26. val isUnofficial: Boolean = false,
  27. val isShared: Boolean,
  28. ) : Extension()
  29. data class Available(
  30. override val name: String,
  31. override val pkgName: String,
  32. override val versionName: String,
  33. override val versionCode: Long,
  34. override val libVersion: Double,
  35. override val lang: String,
  36. override val isNsfw: Boolean,
  37. val sources: List<Source>,
  38. val apkName: String,
  39. val iconUrl: String,
  40. ) : Extension() {
  41. data class Source(
  42. val id: Long,
  43. val lang: String,
  44. val name: String,
  45. val baseUrl: String,
  46. ) {
  47. fun toStubSource(): StubSource {
  48. return StubSource(
  49. id = this.id,
  50. lang = this.lang,
  51. name = this.name,
  52. )
  53. }
  54. }
  55. }
  56. data class Untrusted(
  57. override val name: String,
  58. override val pkgName: String,
  59. override val versionName: String,
  60. override val versionCode: Long,
  61. override val libVersion: Double,
  62. val signatureHash: String,
  63. override val lang: String? = null,
  64. override val isNsfw: Boolean = false,
  65. ) : Extension()
  66. }