mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-13 20:48:56 +01:00
MangaController overhaul (#7244)
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user