Removing the logic for cleaning the old way for saving custom manga info

This commit is contained in:
Jays2Kings 2021-04-14 15:53:13 -04:00
parent 2c7db3c2be
commit 928fc06e58
4 changed files with 3 additions and 20 deletions

View File

@ -114,11 +114,6 @@ interface MangaQueries : DbProvider {
.withPutResolver(MangaInfoPutResolver())
.prepare()
fun resetMangaInfo(manga: Manga) = db.put()
.`object`(manga)
.withPutResolver(MangaInfoPutResolver(true))
.prepare()
fun deleteManga(manga: Manga) = db.delete().`object`(manga).prepare()
fun deleteMangas(mangas: List<Manga>) = db.delete().objects(mangas).prepare()

View File

@ -9,11 +9,11 @@ import eu.kanade.tachiyomi.data.database.inTransactionReturn
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.tables.MangaTable
class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
class MangaInfoPutResolver() : PutResolver<Manga>() {
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
val updateQuery = mapToUpdateQuery(manga)
val contentValues = if (reset) resetToContentValues(manga) else mapToContentValues(manga)
val contentValues = mapToContentValues(manga)
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
@ -32,13 +32,4 @@ class MangaInfoPutResolver(val reset: Boolean = false) : PutResolver<Manga>() {
put(MangaTable.COL_ARTIST, manga.originalArtist)
put(MangaTable.COL_DESCRIPTION, manga.originalDescription)
}
fun resetToContentValues(manga: Manga) = ContentValues(1).apply {
val splitter = "▒ ▒∩▒"
put(MangaTable.COL_TITLE, manga.title.split(splitter).last())
put(MangaTable.COL_GENRE, manga.genre?.split(splitter)?.lastOrNull())
put(MangaTable.COL_AUTHOR, manga.author?.split(splitter)?.lastOrNull())
put(MangaTable.COL_ARTIST, manga.artist?.split(splitter)?.lastOrNull())
put(MangaTable.COL_DESCRIPTION, manga.description?.split(splitter)?.lastOrNull())
}
}

View File

@ -729,7 +729,6 @@ class LibraryPresenter(
scope.launch {
val mangaToDelete = mangas.distinctBy { it.id }
mangaToDelete.forEach { manga ->
db.resetMangaInfo(manga).executeOnIO()
coverCache.deleteFromCache(manga)
val source = sourceManager.get(manga.source) as? HttpSource
if (source != null) {
@ -927,7 +926,7 @@ class LibraryPresenter(
private var lastLibraryItems: List<LibraryItem>? = null
private var lastCategories: List<Category>? = null
/** Give library manga to a date added based on min chapter fetch + remove custom info */
/** Give library manga to a date added based on min chapter fetch */
fun updateDB() {
val db: DatabaseHelper = Injekt.get()
db.inTransaction {
@ -938,7 +937,6 @@ class LibraryPresenter(
manga.date_added = chapters.minByOrNull { it.date_fetch }?.date_fetch ?: 0L
db.insertManga(manga).executeAsBlocking()
}
db.resetMangaInfo(manga).executeAsBlocking()
}
}
}

View File

@ -280,7 +280,6 @@ open class BrowseSourcePresenter(
coverCache.deleteFromCache(manga)
val downloadManager: DownloadManager = Injekt.get()
downloadManager.deleteManga(manga, source)
db.resetMangaInfo(manga).executeAsBlocking()
}
/**