From d098eca69d0abc1c68e88811a13bad35c750f387 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 11 Jun 2022 11:51:14 -0400 Subject: [PATCH] Remove unused database resolvers/queries --- .../database/models/MangaChapterHistory.kt | 10 ------ .../data/database/queries/ChapterQueries.kt | 6 ---- .../ChapterSourceOrderPutResolver.kt | 32 ------------------- 3 files changed, 48 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt deleted file mode 100644 index 5ed7ed455..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaChapterHistory.kt +++ /dev/null @@ -1,10 +0,0 @@ -package eu.kanade.tachiyomi.data.database.models - -/** - * Object containing manga, chapter and history - * - * @param manga object containing manga - * @param chapter object containing chater - * @param history object containing history - */ -data class MangaChapterHistory(val manga: Manga, val chapter: Chapter, val history: History) 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 9e1945f85..9e237d356 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 @@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.data.database.models.MangaChapter import eu.kanade.tachiyomi.data.database.resolvers.ChapterBackupPutResolver import eu.kanade.tachiyomi.data.database.resolvers.ChapterKnownBackupPutResolver import eu.kanade.tachiyomi.data.database.resolvers.ChapterProgressPutResolver -import eu.kanade.tachiyomi.data.database.resolvers.ChapterSourceOrderPutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaChapterGetResolver import eu.kanade.tachiyomi.data.database.tables.ChapterTable import java.util.Date @@ -95,9 +94,4 @@ interface ChapterQueries : DbProvider { .objects(chapters) .withPutResolver(ChapterProgressPutResolver()) .prepare() - - fun fixChaptersSourceOrder(chapters: List) = db.put() - .objects(chapters) - .withPutResolver(ChapterSourceOrderPutResolver()) - .prepare() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt deleted file mode 100644 index 1e39d6534..000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/ChapterSourceOrderPutResolver.kt +++ /dev/null @@ -1,32 +0,0 @@ -package eu.kanade.tachiyomi.data.database.resolvers - -import androidx.core.content.contentValuesOf -import com.pushtorefresh.storio.sqlite.StorIOSQLite -import com.pushtorefresh.storio.sqlite.operations.put.PutResolver -import com.pushtorefresh.storio.sqlite.operations.put.PutResult -import com.pushtorefresh.storio.sqlite.queries.UpdateQuery -import eu.kanade.tachiyomi.data.database.inTransactionReturn -import eu.kanade.tachiyomi.data.database.models.Chapter -import eu.kanade.tachiyomi.data.database.tables.ChapterTable - -class ChapterSourceOrderPutResolver : PutResolver() { - - override fun performPut(db: StorIOSQLite, chapter: Chapter) = db.inTransactionReturn { - val updateQuery = mapToUpdateQuery(chapter) - val contentValues = mapToContentValues(chapter) - - val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues) - PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table()) - } - - fun mapToUpdateQuery(chapter: Chapter) = UpdateQuery.builder() - .table(ChapterTable.TABLE) - .where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?") - .whereArgs(chapter.url, chapter.manga_id) - .build() - - fun mapToContentValues(chapter: Chapter) = - contentValuesOf( - ChapterTable.COL_SOURCE_ORDER to chapter.source_order, - ) -}