Removing hide title from manga

Since there's comfortable grid there's no need for it now
This commit is contained in:
Jay 2020-04-07 23:45:52 -04:00
parent 26571a2508
commit 00bd80b5fa
8 changed files with 0 additions and 62 deletions

View File

@ -69,9 +69,6 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
db.execSQL(MangaTable.createLibraryIndexQuery) db.execSQL(MangaTable.createLibraryIndexQuery)
db.execSQL(ChapterTable.createUnreadChaptersIndexQuery) db.execSQL(ChapterTable.createUnreadChaptersIndexQuery)
} }
if (oldVersion < 9) {
db.execSQL(MangaTable.addHideTitle)
}
if (oldVersion < 10) { if (oldVersion < 10) {
db.execSQL(CategoryTable.addMangaOrder) db.execSQL(CategoryTable.addMangaOrder)
} }

View File

@ -18,7 +18,6 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_CHAPTER_FLAGS
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_DESCRIPTION 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_FAVORITE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_GENRE import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_GENRE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_HIDE_TITLE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_ID import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_ID
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_INITIALIZED import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_INITIALIZED
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_LAST_UPDATE import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_LAST_UPDATE
@ -63,7 +62,6 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
put(COL_LAST_UPDATE, obj.last_update) put(COL_LAST_UPDATE, obj.last_update)
put(COL_INITIALIZED, obj.initialized) put(COL_INITIALIZED, obj.initialized)
put(COL_VIEWER, obj.viewer) put(COL_VIEWER, obj.viewer)
put(COL_HIDE_TITLE, obj.hide_title)
put(COL_CHAPTER_FLAGS, obj.chapter_flags) put(COL_CHAPTER_FLAGS, obj.chapter_flags)
put(MangaTable.COL_DATE_ADDED, obj.date_added) put(MangaTable.COL_DATE_ADDED, obj.date_added)
} }
@ -86,7 +84,6 @@ interface BaseMangaGetResolver {
initialized = cursor.getInt(cursor.getColumnIndex(COL_INITIALIZED)) == 1 initialized = cursor.getInt(cursor.getColumnIndex(COL_INITIALIZED)) == 1
viewer = cursor.getInt(cursor.getColumnIndex(COL_VIEWER)) viewer = cursor.getInt(cursor.getColumnIndex(COL_VIEWER))
chapter_flags = cursor.getInt(cursor.getColumnIndex(COL_CHAPTER_FLAGS)) chapter_flags = cursor.getInt(cursor.getColumnIndex(COL_CHAPTER_FLAGS))
hide_title = cursor.getInt(cursor.getColumnIndex(COL_HIDE_TITLE)) == 1
date_added = cursor.getLong(cursor.getColumnIndex(MangaTable.COL_DATE_ADDED)) date_added = cursor.getLong(cursor.getColumnIndex(MangaTable.COL_DATE_ADDED))
} }
} }

View File

@ -23,8 +23,6 @@ interface Manga : SManga {
var chapter_flags: Int var chapter_flags: Int
var hide_title: Boolean
fun setChapterOrder(order: Int) { fun setChapterOrder(order: Int) {
setFlags(order, SORT_MASK) setFlags(order, SORT_MASK)
setFlags(SORT_LOCAL, SORT_SELF_MASK) setFlags(SORT_LOCAL, SORT_SELF_MASK)

View File

@ -38,8 +38,6 @@ open class MangaImpl : Manga {
override var chapter_flags: Int = 0 override var chapter_flags: Int = 0
override var hide_title: Boolean = false
override var date_added: Long = 0 override var date_added: Long = 0
override fun copyFrom(other: SManga) { override fun copyFrom(other: SManga) {

View File

@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.resolvers.LibraryMangaGetResolver import eu.kanade.tachiyomi.data.database.resolvers.LibraryMangaGetResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaFavoritePutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaFavoritePutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaFlagsPutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaFlagsPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaHideTitlePutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaInfoPutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaInfoPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaLastUpdatedPutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaLastUpdatedPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaTitlePutResolver import eu.kanade.tachiyomi.data.database.resolvers.MangaTitlePutResolver
@ -98,11 +97,6 @@ interface MangaQueries : DbProvider {
.withPutResolver(MangaViewerPutResolver()) .withPutResolver(MangaViewerPutResolver())
.prepare() .prepare()
fun updateMangaHideTitle(manga: Manga) = db.put()
.`object`(manga)
.withPutResolver(MangaHideTitlePutResolver())
.prepare()
fun updateMangaTitle(manga: Manga) = db.put() fun updateMangaTitle(manga: Manga) = db.put()
.`object`(manga) .`object`(manga)
.withPutResolver(MangaTitlePutResolver()) .withPutResolver(MangaTitlePutResolver())

View File

@ -1,31 +0,0 @@
package eu.kanade.tachiyomi.data.database.resolvers
import android.content.ContentValues
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.Manga
import eu.kanade.tachiyomi.data.database.tables.MangaTable
class MangaHideTitlePutResolver : PutResolver<Manga>() {
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
val updateQuery = mapToUpdateQuery(manga)
val contentValues = mapToContentValues(manga)
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
}
fun mapToUpdateQuery(manga: Manga) = UpdateQuery.builder()
.table(MangaTable.TABLE)
.where("${MangaTable.COL_ID} = ?")
.whereArgs(manga.id)
.build()
fun mapToContentValues(manga: Manga) = ContentValues(1).apply {
put(MangaTable.COL_HIDE_TITLE, manga.hide_title)
}
}

View File

@ -38,8 +38,6 @@ object MangaTable {
const val COL_CATEGORY = "category" const val COL_CATEGORY = "category"
const val COL_HIDE_TITLE = "hideTitle"
const val COL_DATE_ADDED = "date_added" const val COL_DATE_ADDED = "date_added"
val createTableQuery: String val createTableQuery: String
@ -58,7 +56,6 @@ object MangaTable {
$COL_LAST_UPDATE LONG, $COL_LAST_UPDATE LONG,
$COL_INITIALIZED BOOLEAN NOT NULL, $COL_INITIALIZED BOOLEAN NOT NULL,
$COL_VIEWER INTEGER NOT NULL, $COL_VIEWER INTEGER NOT NULL,
$COL_HIDE_TITLE INTEGER NOT NULL,
$COL_CHAPTER_FLAGS INTEGER NOT NULL, $COL_CHAPTER_FLAGS INTEGER NOT NULL,
$COL_DATE_ADDED LONG $COL_DATE_ADDED LONG
@ -71,9 +68,6 @@ object MangaTable {
get() = "CREATE INDEX library_${COL_FAVORITE}_index ON $TABLE($COL_FAVORITE) " + get() = "CREATE INDEX library_${COL_FAVORITE}_index ON $TABLE($COL_FAVORITE) " +
"WHERE $COL_FAVORITE = 1" "WHERE $COL_FAVORITE = 1"
val addHideTitle: String
get() = "ALTER TABLE $TABLE ADD COLUMN $COL_HIDE_TITLE INTEGER DEFAULT 0"
val addDateAddedCol: String val addDateAddedCol: String
get() = "ALTER TABLE ${MangaTable.TABLE} ADD COLUMN ${MangaTable.COL_DATE_ADDED} LONG DEFAULT 0" get() = "ALTER TABLE ${MangaTable.TABLE} ADD COLUMN ${MangaTable.COL_DATE_ADDED} LONG DEFAULT 0"
} }

View File

@ -747,15 +747,6 @@ class LibraryPresenter(
.subscribe() .subscribe()
} }
fun hideShowTitle(mangas: List<Manga>, hide: Boolean) {
mangas.forEach { it.hide_title = hide }
db.inTransaction {
mangas.forEach {
db.updateMangaHideTitle(it).executeAsBlocking()
}
}
}
private fun migrateMangaInternal( private fun migrateMangaInternal(
source: Source, source: Source,
sourceChapters: List<SChapter>, sourceChapters: List<SChapter>,