Cleanup & adding comments

This commit is contained in:
Jay 2020-04-08 00:02:35 -04:00
parent 00bd80b5fa
commit 4828f934b5
3 changed files with 15 additions and 13 deletions

View File

@ -11,10 +11,10 @@ import com.pushtorefresh.storio.sqlite.queries.InsertQuery
import com.pushtorefresh.storio.sqlite.queries.UpdateQuery
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaImpl
import eu.kanade.tachiyomi.data.database.tables.MangaTable
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_ARTIST
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_AUTHOR
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_CHAPTER_FLAGS
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_DATE_ADDED
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_DESCRIPTION
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_FAVORITE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_GENRE
@ -63,7 +63,7 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
put(COL_INITIALIZED, obj.initialized)
put(COL_VIEWER, obj.viewer)
put(COL_CHAPTER_FLAGS, obj.chapter_flags)
put(MangaTable.COL_DATE_ADDED, obj.date_added)
put(COL_DATE_ADDED, obj.date_added)
}
}
@ -84,7 +84,7 @@ interface BaseMangaGetResolver {
initialized = cursor.getInt(cursor.getColumnIndex(COL_INITIALIZED)) == 1
viewer = cursor.getInt(cursor.getColumnIndex(COL_VIEWER))
chapter_flags = cursor.getInt(cursor.getColumnIndex(COL_CHAPTER_FLAGS))
date_added = cursor.getLong(cursor.getColumnIndex(MangaTable.COL_DATE_ADDED))
date_added = cursor.getLong(cursor.getColumnIndex(COL_DATE_ADDED))
}
}

View File

@ -43,10 +43,11 @@ interface Manga : SManga {
else sortDescending()
}
fun showChapterTitle(defaultShow: Boolean): Boolean {
return chapter_flags and DISPLAY_MASK == DISPLAY_NUMBER
}
fun showChapterTitle(defaultShow: Boolean): Boolean = chapter_flags and DISPLAY_MASK == DISPLAY_NUMBER
/**
* The type of comic the manga is (ie. manga, manhwa, manhua)
*/
fun mangaType(): Int {
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
val currentTags = genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
@ -79,6 +80,10 @@ interface Manga : SManga {
else TYPE_MANGA
}
/**
* The type the reader should use. Different from manga type as certain manga has different
* read types
*/
fun defaultReaderType(): Int {
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
val currentTags = genre?.split(",")?.map { it.trim().toLowerCase(Locale.US) }
@ -145,10 +150,6 @@ interface Manga : SManga {
const val SORT_LOCAL = 0x00001000
const val SORT_SELF_MASK = 0x00001000
/*const val HIDE_GLOBAL = 0x00000000
const val HIDE_LOCAL = 0x00010000
const val HIDE_SELF_MASK = 0x00010000*/
// Generic filter that does not filter anything
const val SHOW_ALL = 0x00000000

View File

@ -64,7 +64,7 @@ fun getRecentsQuery() = """
"""
/**
* Query to get the recent chapters of manga from the library up to a date.
* Query to get the recently added manga
*/
fun getRecentAdditionsQuery(search: String) = """
SELECT ${Manga.TABLE}.${Manga.COL_URL} as mangaUrl, * FROM ${Manga.TABLE}
@ -76,7 +76,7 @@ fun getRecentAdditionsQuery(search: String) = """
"""
/**
* Query to get the recent chapters of manga from the library up to a date.
* Query to get the manga with recently uploaded chapters
*/
fun getRecentsQueryDistinct(search: String) = """
SELECT ${Manga.TABLE}.${Manga.COL_URL} as mangaUrl, ${Manga.TABLE}.*, ${Chapter.TABLE}.*
@ -153,7 +153,8 @@ fun getRecentMangasLimitQuery(limit: Int = 25, search: String = "") = """
"""
/**
* Query to get the recently read chapters of manga from the library up to a date.
* Query to get the recently read manga that has more chapters to read
* The first from checks that there's an unread chapter
* The max_last_read table contains the most recent chapters grouped by manga
* The select statement returns all information of chapters that have the same id as the chapter in max_last_read
* and are read after the given time period