From 2dfbfd095876ea909d33db46e88d4bd670cc1e2f Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 2 Jul 2022 13:08:08 -0400 Subject: [PATCH] Remove more unused StorIO code --- .../tachiyomi/data/database/DatabaseHelper.kt | 8 -- .../database/mappers/HistoryTypeMapping.kt | 64 ------------- .../data/database/mappers/TrackTypeMapping.kt | 91 ------------------- .../tachiyomi/data/database/models/History.kt | 42 --------- .../data/database/models/HistoryImpl.kt | 27 ------ .../data/database/models/MangaCategory.kt | 9 -- .../data/database/models/MangaChapter.kt | 3 - .../data/database/queries/CategoryQueries.kt | 5 +- .../data/database/queries/ChapterQueries.kt | 10 +- .../resolvers/MangaChapterGetResolver.kt | 27 ------ .../data/database/tables/HistoryTable.kt | 29 ------ .../data/database/tables/TrackTable.kt | 32 ------- .../data/download/DownloadManager.kt | 2 +- .../source/browse/BrowseSourcePresenter.kt | 2 +- .../tachiyomi/ui/reader/ReaderPresenter.kt | 2 +- .../kanade/tachiyomi/util/MangaExtensions.kt | 2 +- 16 files changed, 8 insertions(+), 347 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/HistoryTypeMapping.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/models/History.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/models/HistoryImpl.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapter.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/tables/HistoryTable.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/tables/TrackTable.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt index 3e2db4bbb9..1a8d96ee02 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DatabaseHelper.kt @@ -4,16 +4,12 @@ import androidx.sqlite.db.SupportSQLiteOpenHelper import com.pushtorefresh.storio.sqlite.impl.DefaultStorIOSQLite import eu.kanade.tachiyomi.data.database.mappers.CategoryTypeMapping import eu.kanade.tachiyomi.data.database.mappers.ChapterTypeMapping -import eu.kanade.tachiyomi.data.database.mappers.HistoryTypeMapping import eu.kanade.tachiyomi.data.database.mappers.MangaCategoryTypeMapping import eu.kanade.tachiyomi.data.database.mappers.MangaTypeMapping -import eu.kanade.tachiyomi.data.database.mappers.TrackTypeMapping import eu.kanade.tachiyomi.data.database.models.Category import eu.kanade.tachiyomi.data.database.models.Chapter -import eu.kanade.tachiyomi.data.database.models.History import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.models.MangaCategory -import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.database.queries.CategoryQueries import eu.kanade.tachiyomi.data.database.queries.ChapterQueries import eu.kanade.tachiyomi.data.database.queries.MangaCategoryQueries @@ -31,11 +27,7 @@ class DatabaseHelper( .sqliteOpenHelper(openHelper) .addTypeMapping(Manga::class.java, MangaTypeMapping()) .addTypeMapping(Chapter::class.java, ChapterTypeMapping()) - .addTypeMapping(Track::class.java, TrackTypeMapping()) .addTypeMapping(Category::class.java, CategoryTypeMapping()) .addTypeMapping(MangaCategory::class.java, MangaCategoryTypeMapping()) - .addTypeMapping(History::class.java, HistoryTypeMapping()) .build() - - inline fun inTransaction(block: () -> Unit) = db.inTransaction(block) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/HistoryTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/HistoryTypeMapping.kt deleted file mode 100644 index 836eb3c13b..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/HistoryTypeMapping.kt +++ /dev/null @@ -1,64 +0,0 @@ -package eu.kanade.tachiyomi.data.database.mappers - -import android.database.Cursor -import androidx.core.content.contentValuesOf -import com.pushtorefresh.storio.sqlite.SQLiteTypeMapping -import com.pushtorefresh.storio.sqlite.operations.delete.DefaultDeleteResolver -import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver -import com.pushtorefresh.storio.sqlite.operations.put.DefaultPutResolver -import com.pushtorefresh.storio.sqlite.queries.DeleteQuery -import com.pushtorefresh.storio.sqlite.queries.InsertQuery -import com.pushtorefresh.storio.sqlite.queries.UpdateQuery -import eu.kanade.tachiyomi.data.database.models.History -import eu.kanade.tachiyomi.data.database.models.HistoryImpl -import eu.kanade.tachiyomi.data.database.tables.HistoryTable.COL_CHAPTER_ID -import eu.kanade.tachiyomi.data.database.tables.HistoryTable.COL_ID -import eu.kanade.tachiyomi.data.database.tables.HistoryTable.COL_LAST_READ -import eu.kanade.tachiyomi.data.database.tables.HistoryTable.COL_TIME_READ -import eu.kanade.tachiyomi.data.database.tables.HistoryTable.TABLE - -class HistoryTypeMapping : SQLiteTypeMapping( - HistoryPutResolver(), - HistoryGetResolver(), - HistoryDeleteResolver(), -) - -open class HistoryPutResolver : DefaultPutResolver() { - - override fun mapToInsertQuery(obj: History) = InsertQuery.builder() - .table(TABLE) - .build() - - override fun mapToUpdateQuery(obj: History) = UpdateQuery.builder() - .table(TABLE) - .where("$COL_ID = ?") - .whereArgs(obj.id) - .build() - - override fun mapToContentValues(obj: History) = - contentValuesOf( - COL_ID to obj.id, - COL_CHAPTER_ID to obj.chapter_id, - COL_LAST_READ to obj.last_read, - COL_TIME_READ to obj.time_read, - ) -} - -class HistoryGetResolver : DefaultGetResolver() { - - override fun mapFromCursor(cursor: Cursor): History = HistoryImpl().apply { - id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID)) - chapter_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_CHAPTER_ID)) - last_read = cursor.getLong(cursor.getColumnIndexOrThrow(COL_LAST_READ)) - time_read = cursor.getLong(cursor.getColumnIndexOrThrow(COL_TIME_READ)) - } -} - -class HistoryDeleteResolver : DefaultDeleteResolver() { - - override fun mapToDeleteQuery(obj: History) = DeleteQuery.builder() - .table(TABLE) - .where("$COL_ID = ?") - .whereArgs(obj.id) - .build() -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt deleted file mode 100644 index 764f2325af..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/TrackTypeMapping.kt +++ /dev/null @@ -1,91 +0,0 @@ -package eu.kanade.tachiyomi.data.database.mappers - -import android.database.Cursor -import androidx.core.content.contentValuesOf -import com.pushtorefresh.storio.sqlite.SQLiteTypeMapping -import com.pushtorefresh.storio.sqlite.operations.delete.DefaultDeleteResolver -import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver -import com.pushtorefresh.storio.sqlite.operations.put.DefaultPutResolver -import com.pushtorefresh.storio.sqlite.queries.DeleteQuery -import com.pushtorefresh.storio.sqlite.queries.InsertQuery -import com.pushtorefresh.storio.sqlite.queries.UpdateQuery -import eu.kanade.tachiyomi.data.database.models.Track -import eu.kanade.tachiyomi.data.database.models.TrackImpl -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_FINISH_DATE -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_ID -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_LAST_CHAPTER_READ -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_LIBRARY_ID -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_MANGA_ID -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_MEDIA_ID -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_SCORE -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_START_DATE -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_STATUS -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_SYNC_ID -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_TITLE -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_TOTAL_CHAPTERS -import eu.kanade.tachiyomi.data.database.tables.TrackTable.COL_TRACKING_URL -import eu.kanade.tachiyomi.data.database.tables.TrackTable.TABLE - -class TrackTypeMapping : SQLiteTypeMapping( - TrackPutResolver(), - TrackGetResolver(), - TrackDeleteResolver(), -) - -class TrackPutResolver : DefaultPutResolver() { - - override fun mapToInsertQuery(obj: Track) = InsertQuery.builder() - .table(TABLE) - .build() - - override fun mapToUpdateQuery(obj: Track) = UpdateQuery.builder() - .table(TABLE) - .where("$COL_ID = ?") - .whereArgs(obj.id) - .build() - - override fun mapToContentValues(obj: Track) = - contentValuesOf( - COL_ID to obj.id, - COL_MANGA_ID to obj.manga_id, - COL_SYNC_ID to obj.sync_id, - COL_MEDIA_ID to obj.media_id, - COL_LIBRARY_ID to obj.library_id, - COL_TITLE to obj.title, - COL_LAST_CHAPTER_READ to obj.last_chapter_read, - COL_TOTAL_CHAPTERS to obj.total_chapters, - COL_STATUS to obj.status, - COL_TRACKING_URL to obj.tracking_url, - COL_SCORE to obj.score, - COL_START_DATE to obj.started_reading_date, - COL_FINISH_DATE to obj.finished_reading_date, - ) -} - -class TrackGetResolver : DefaultGetResolver() { - - override fun mapFromCursor(cursor: Cursor): Track = TrackImpl().apply { - id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID)) - manga_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID)) - sync_id = cursor.getInt(cursor.getColumnIndexOrThrow(COL_SYNC_ID)) - media_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MEDIA_ID)) - library_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_LIBRARY_ID)) - title = cursor.getString(cursor.getColumnIndexOrThrow(COL_TITLE)) - last_chapter_read = cursor.getFloat(cursor.getColumnIndexOrThrow(COL_LAST_CHAPTER_READ)) - total_chapters = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TOTAL_CHAPTERS)) - status = cursor.getInt(cursor.getColumnIndexOrThrow(COL_STATUS)) - score = cursor.getFloat(cursor.getColumnIndexOrThrow(COL_SCORE)) - tracking_url = cursor.getString(cursor.getColumnIndexOrThrow(COL_TRACKING_URL)) - started_reading_date = cursor.getLong(cursor.getColumnIndexOrThrow(COL_START_DATE)) - finished_reading_date = cursor.getLong(cursor.getColumnIndexOrThrow(COL_FINISH_DATE)) - } -} - -class TrackDeleteResolver : DefaultDeleteResolver() { - - override fun mapToDeleteQuery(obj: Track) = DeleteQuery.builder() - .table(TABLE) - .where("$COL_ID = ?") - .whereArgs(obj.id) - .build() -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/History.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/History.kt deleted file mode 100644 index 10429f8b1d..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/History.kt +++ /dev/null @@ -1,42 +0,0 @@ -package eu.kanade.tachiyomi.data.database.models - -import java.io.Serializable - -/** - * Object containing the history statistics of a chapter - */ -interface History : Serializable { - - /** - * Id of history object. - */ - var id: Long? - - /** - * Chapter id of history object. - */ - var chapter_id: Long - - /** - * Last time chapter was read in time long format - */ - var last_read: Long - - /** - * Total time chapter was read - */ - var time_read: Long - - companion object { - - /** - * History constructor - * - * @param chapter chapter object - * @return history object - */ - fun create(chapter: Chapter): History = HistoryImpl().apply { - this.chapter_id = chapter.id!! - } - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/HistoryImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/HistoryImpl.kt deleted file mode 100644 index 8b9dbe7662..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/HistoryImpl.kt +++ /dev/null @@ -1,27 +0,0 @@ -package eu.kanade.tachiyomi.data.database.models - -/** - * Object containing the history statistics of a chapter - */ -class HistoryImpl : History { - - /** - * Id of history object. - */ - override var id: Long? = null - - /** - * Chapter id of history object. - */ - override var chapter_id: Long = 0 - - /** - * Last time chapter was read in time long format - */ - override var last_read: Long = 0 - - /** - * Total time chapter was read - */ - override var time_read: Long = 0 -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt index 90dacc8788..2203370884 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaCategory.kt @@ -1,7 +1,5 @@ package eu.kanade.tachiyomi.data.database.models -import data.GetCategories - class MangaCategory { var id: Long? = null @@ -18,12 +16,5 @@ class MangaCategory { mc.category_id = category.id!! return mc } - - fun create(manga: Manga, category: GetCategories): MangaCategory { - val mc = MangaCategory() - mc.manga_id = manga.id!! - mc.category_id = category.id.toInt() - return mc - } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapter.kt deleted file mode 100644 index bf584ba9c8..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapter.kt +++ /dev/null @@ -1,3 +0,0 @@ -package eu.kanade.tachiyomi.data.database.models - -class MangaChapter(val manga: Manga, val chapter: Chapter) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt index 48b1e5bebe..3fddec4c11 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/CategoryQueries.kt @@ -4,7 +4,6 @@ import com.pushtorefresh.storio.sqlite.queries.Query import com.pushtorefresh.storio.sqlite.queries.RawQuery import eu.kanade.tachiyomi.data.database.DbProvider import eu.kanade.tachiyomi.data.database.models.Category -import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.tables.CategoryTable interface CategoryQueries : DbProvider { @@ -19,12 +18,12 @@ interface CategoryQueries : DbProvider { ) .prepare() - fun getCategoriesForManga(manga: Manga) = db.get() + fun getCategoriesForManga(mangaId: Long) = db.get() .listOfObjects(Category::class.java) .withQuery( RawQuery.builder() .query(getCategoriesForMangaQuery()) - .args(manga.id) + .args(mangaId) .build(), ) .prepare() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt index b4c5aa2f73..35b7bcfe86 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt @@ -3,19 +3,18 @@ package eu.kanade.tachiyomi.data.database.queries import com.pushtorefresh.storio.sqlite.queries.Query import eu.kanade.tachiyomi.data.database.DbProvider import eu.kanade.tachiyomi.data.database.models.Chapter -import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.database.resolvers.ChapterProgressPutResolver import eu.kanade.tachiyomi.data.database.tables.ChapterTable interface ChapterQueries : DbProvider { - fun getChapters(manga: Manga) = db.get() + fun getChapters(mangaId: Long) = db.get() .listOfObjects(Chapter::class.java) .withQuery( Query.builder() .table(ChapterTable.TABLE) .where("${ChapterTable.COL_MANGA_ID} = ?") - .whereArgs(manga.id) + .whereArgs(mangaId) .build(), ) .prepare() @@ -46,9 +45,4 @@ interface ChapterQueries : DbProvider { .`object`(chapter) .withPutResolver(ChapterProgressPutResolver()) .prepare() - - fun updateChaptersProgress(chapters: List) = db.put() - .objects(chapters) - .withPutResolver(ChapterProgressPutResolver()) - .prepare() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt deleted file mode 100644 index a6305b1bae..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaChapterGetResolver.kt +++ /dev/null @@ -1,27 +0,0 @@ -package eu.kanade.tachiyomi.data.database.resolvers - -import android.database.Cursor -import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver -import eu.kanade.tachiyomi.data.database.mappers.ChapterGetResolver -import eu.kanade.tachiyomi.data.database.mappers.MangaGetResolver -import eu.kanade.tachiyomi.data.database.models.MangaChapter - -class MangaChapterGetResolver : DefaultGetResolver() { - - companion object { - val INSTANCE = MangaChapterGetResolver() - } - - private val mangaGetResolver = MangaGetResolver() - - private val chapterGetResolver = ChapterGetResolver() - - override fun mapFromCursor(cursor: Cursor): MangaChapter { - val manga = mangaGetResolver.mapFromCursor(cursor) - val chapter = chapterGetResolver.mapFromCursor(cursor) - manga.id = chapter.manga_id - manga.url = cursor.getString(cursor.getColumnIndexOrThrow("mangaUrl")) - - return MangaChapter(manga, chapter) - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/HistoryTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/HistoryTable.kt deleted file mode 100644 index e3eab5dee5..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/HistoryTable.kt +++ /dev/null @@ -1,29 +0,0 @@ -package eu.kanade.tachiyomi.data.database.tables - -object HistoryTable { - - /** - * Table name - */ - const val TABLE = "history" - - /** - * Id column name - */ - const val COL_ID = "_id" - - /** - * Chapter id column name - */ - const val COL_CHAPTER_ID = "chapter_id" - - /** - * Last read column name - */ - const val COL_LAST_READ = "last_read" - - /** - * Time read column name - */ - const val COL_TIME_READ = "time_read" -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/TrackTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/TrackTable.kt deleted file mode 100644 index 05ee195f33..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/TrackTable.kt +++ /dev/null @@ -1,32 +0,0 @@ -package eu.kanade.tachiyomi.data.database.tables - -object TrackTable { - - const val TABLE = "manga_sync" - - const val COL_ID = "_id" - - const val COL_MANGA_ID = "manga_id" - - const val COL_SYNC_ID = "sync_id" - - const val COL_MEDIA_ID = "remote_id" - - const val COL_LIBRARY_ID = "library_id" - - const val COL_TITLE = "title" - - const val COL_LAST_CHAPTER_READ = "last_chapter_read" - - const val COL_STATUS = "status" - - const val COL_SCORE = "score" - - const val COL_TOTAL_CHAPTERS = "total_chapters" - - const val COL_TRACKING_URL = "remote_url" - - const val COL_START_DATE = "start_date" - - const val COL_FINISH_DATE = "finish_date" -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt index 66e4bd9b64..5f6a688189 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadManager.kt @@ -362,7 +362,7 @@ class DownloadManager( private fun getChaptersToDelete(chapters: List, manga: Manga): List { // Retrieve the categories that are set to exclude from being deleted on read val categoriesToExclude = preferences.removeExcludeCategories().get().map(String::toInt) - val categoriesForManga = db.getCategoriesForManga(manga).executeAsBlocking() + val categoriesForManga = db.getCategoriesForManga(manga.id!!).executeAsBlocking() .mapNotNull { it.id } .takeUnless { it.isEmpty() } ?: listOf(0) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt index cadb468eca..a1f64bf1e1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt @@ -373,7 +373,7 @@ open class BrowseSourcePresenter( * @return Array of category ids the manga is in, if none returns default id */ fun getMangaCategoryIds(manga: Manga): Array { - val categories = db.getCategoriesForManga(manga).executeAsBlocking() + val categories = db.getCategoriesForManga(manga.id!!).executeAsBlocking() return categories.mapNotNull { it?.id?.toLong() }.toTypedArray() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 2dd01568ba..cf4315f76f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -118,7 +118,7 @@ class ReaderPresenter( */ private val chapterList by lazy { val manga = manga!! - val dbChapters = db.getChapters(manga).executeAsBlocking() + val dbChapters = db.getChapters(manga.id!!).executeAsBlocking() val selectedChapter = dbChapters.find { it.id == chapterId } ?: error("Requested chapter of id $chapterId not found in chapter list") diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt index 9fdb0dea41..9d795247c3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/MangaExtensions.kt @@ -75,7 +75,7 @@ fun DomainManga.shouldDownloadNewChapters(db: DatabaseHelper, prefs: Preferences // Get all categories, else default category (0) val categoriesForManga = - db.getCategoriesForManga(toDbManga()).executeAsBlocking() + db.getCategoriesForManga(id).executeAsBlocking() .mapNotNull { it.id } .takeUnless { it.isEmpty() } ?: listOf(0)