MangaController overhaul (#7244)

This commit is contained in:
Ivan Iskandar
2022-06-25 22:03:48 +07:00
committed by GitHub
parent cf7ca5bd28
commit 33a778873a
57 changed files with 3701 additions and 2955 deletions

View File

@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.database.models
import eu.kanade.tachiyomi.source.model.SChapter
import java.io.Serializable
import eu.kanade.domain.chapter.model.Chapter as DomainChapter
interface Chapter : SChapter, Serializable {
@@ -29,3 +30,21 @@ interface Chapter : SChapter, Serializable {
}
}
}
fun Chapter.toDomainChapter(): DomainChapter? {
if (id == null || manga_id == null) return null
return DomainChapter(
id = id!!,
mangaId = manga_id!!,
read = read,
bookmark = bookmark,
lastPageRead = last_page_read.toLong(),
dateFetch = date_fetch,
sourceOrder = source_order.toLong(),
url = url,
name = name,
dateUpload = date_upload,
chapterNumber = chapter_number,
scanlator = scanlator,
)
}

View File

@@ -12,4 +12,24 @@ class LibraryManga : MangaImpl() {
get() = readCount > 0
var category: Int = 0
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is LibraryManga) return false
if (!super.equals(other)) return false
if (unreadCount != other.unreadCount) return false
if (readCount != other.readCount) return false
if (category != other.category) return false
return true
}
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + unreadCount
result = 31 * result + readCount
result = 31 * result + category
return result
}
}