mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 18:31:51 +01:00
Only update in-library manga chapter settings instead of all
This commit is contained in:
parent
ed80ee98a7
commit
776194f5b2
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.data.database.queries
|
package eu.kanade.tachiyomi.data.database.queries
|
||||||
|
|
||||||
|
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetListOfObjects
|
||||||
import com.pushtorefresh.storio.sqlite.queries.DeleteQuery
|
import com.pushtorefresh.storio.sqlite.queries.DeleteQuery
|
||||||
import com.pushtorefresh.storio.sqlite.queries.Query
|
import com.pushtorefresh.storio.sqlite.queries.Query
|
||||||
import com.pushtorefresh.storio.sqlite.queries.RawQuery
|
import com.pushtorefresh.storio.sqlite.queries.RawQuery
|
||||||
@ -14,15 +15,6 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable
|
|||||||
|
|
||||||
interface MangaQueries : DbProvider {
|
interface MangaQueries : DbProvider {
|
||||||
|
|
||||||
fun getMangas() = db.get()
|
|
||||||
.listOfObjects(Manga::class.java)
|
|
||||||
.withQuery(
|
|
||||||
Query.builder()
|
|
||||||
.table(MangaTable.TABLE)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.prepare()
|
|
||||||
|
|
||||||
fun getLibraryMangas() = db.get()
|
fun getLibraryMangas() = db.get()
|
||||||
.listOfObjects(LibraryManga::class.java)
|
.listOfObjects(LibraryManga::class.java)
|
||||||
.withQuery(
|
.withQuery(
|
||||||
@ -34,17 +26,21 @@ interface MangaQueries : DbProvider {
|
|||||||
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
.withGetResolver(LibraryMangaGetResolver.INSTANCE)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
fun getFavoriteMangas() = db.get()
|
fun getFavoriteMangas(sortByTitle: Boolean = true): PreparedGetListOfObjects<Manga> {
|
||||||
.listOfObjects(Manga::class.java)
|
var queryBuilder = Query.builder()
|
||||||
.withQuery(
|
.table(MangaTable.TABLE)
|
||||||
Query.builder()
|
.where("${MangaTable.COL_FAVORITE} = ?")
|
||||||
.table(MangaTable.TABLE)
|
.whereArgs(1)
|
||||||
.where("${MangaTable.COL_FAVORITE} = ?")
|
|
||||||
.whereArgs(1)
|
if (sortByTitle) {
|
||||||
.orderBy(MangaTable.COL_TITLE)
|
queryBuilder = queryBuilder.orderBy(MangaTable.COL_TITLE)
|
||||||
.build()
|
}
|
||||||
)
|
|
||||||
.prepare()
|
return db.get()
|
||||||
|
.listOfObjects(Manga::class.java)
|
||||||
|
.withQuery(queryBuilder.build())
|
||||||
|
.prepare()
|
||||||
|
}
|
||||||
|
|
||||||
fun getManga(url: String, sourceId: Long) = db.get()
|
fun getManga(url: String, sourceId: Long) = db.get()
|
||||||
.`object`(Manga::class.java)
|
.`object`(Manga::class.java)
|
||||||
|
@ -44,17 +44,19 @@ object ChapterSettingsHelper {
|
|||||||
*/
|
*/
|
||||||
fun updateAllMangasWithGlobalDefaults() {
|
fun updateAllMangasWithGlobalDefaults() {
|
||||||
launchIO {
|
launchIO {
|
||||||
val updatedMangas = db.getMangas().executeAsBlocking().map { manga ->
|
val updatedMangas = db.getFavoriteMangas(sortByTitle = false)
|
||||||
with(manga) {
|
.executeAsBlocking()
|
||||||
readFilter = prefs.filterChapterByRead()
|
.map { manga ->
|
||||||
downloadedFilter = prefs.filterChapterByDownloaded()
|
with(manga) {
|
||||||
bookmarkedFilter = prefs.filterChapterByBookmarked()
|
readFilter = prefs.filterChapterByRead()
|
||||||
sorting = prefs.sortChapterBySourceOrNumber()
|
downloadedFilter = prefs.filterChapterByDownloaded()
|
||||||
displayMode = prefs.displayChapterByNameOrNumber()
|
bookmarkedFilter = prefs.filterChapterByBookmarked()
|
||||||
setChapterOrder(prefs.sortChapterByAscendingOrDescending())
|
sorting = prefs.sortChapterBySourceOrNumber()
|
||||||
|
displayMode = prefs.displayChapterByNameOrNumber()
|
||||||
|
setChapterOrder(prefs.sortChapterByAscendingOrDescending())
|
||||||
|
}
|
||||||
|
manga
|
||||||
}
|
}
|
||||||
manga
|
|
||||||
}
|
|
||||||
|
|
||||||
db.updateChapterFlags(updatedMangas).executeAsBlocking()
|
db.updateChapterFlags(updatedMangas).executeAsBlocking()
|
||||||
db.updateViewerFlags(updatedMangas).executeAsBlocking()
|
db.updateViewerFlags(updatedMangas).executeAsBlocking()
|
||||||
|
Loading…
Reference in New Issue
Block a user