|
@@ -10,7 +10,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga
|
|
|
import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
|
|
import kotlin.reflect.KProperty1
|
|
|
|
|
|
-class MangaFlagsPutResolver(private val colName: String, private val fieldGetter: KProperty1<Manga, Int>, private val updateAll: Boolean = false) : PutResolver<Manga>() {
|
|
|
+class MangaFlagsPutResolver(private val colName: String, private val fieldGetter: KProperty1<Manga, Int>) : PutResolver<Manga>() {
|
|
|
|
|
|
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
|
|
|
val updateQuery = mapToUpdateQuery(manga)
|
|
@@ -20,21 +20,11 @@ class MangaFlagsPutResolver(private val colName: String, private val fieldGetter
|
|
|
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
|
|
|
}
|
|
|
|
|
|
- fun mapToUpdateQuery(manga: Manga): UpdateQuery {
|
|
|
- val builder = UpdateQuery.builder()
|
|
|
-
|
|
|
- return if (updateAll) {
|
|
|
- builder
|
|
|
- .table(MangaTable.TABLE)
|
|
|
- .build()
|
|
|
- } else {
|
|
|
- builder
|
|
|
- .table(MangaTable.TABLE)
|
|
|
- .where("${MangaTable.COL_ID} = ?")
|
|
|
- .whereArgs(manga.id)
|
|
|
- .build()
|
|
|
- }
|
|
|
- }
|
|
|
+ fun mapToUpdateQuery(manga: Manga) = UpdateQuery.builder()
|
|
|
+ .table(MangaTable.TABLE)
|
|
|
+ .where("${MangaTable.COL_ID} = ?")
|
|
|
+ .whereArgs(manga.id)
|
|
|
+ .build()
|
|
|
|
|
|
fun mapToContentValues(manga: Manga) =
|
|
|
contentValuesOf(
|