mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix(recents): Partially revert SQLDelight migration
getAllRecentsTypes query is too cursed, will need some refactoring
This commit is contained in:
parent
6e3eaad481
commit
0d9ffc2206
3 changed files with 43 additions and 1 deletions
|
@ -142,4 +142,35 @@ interface HistoryQueries : DbProvider {
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.prepare()
|
.prepare()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns history of recent manga containing last read chapter in 25s
|
||||||
|
* @param date recent date range
|
||||||
|
* @offset offset the db by
|
||||||
|
*/
|
||||||
|
fun getAllRecentsTypes(
|
||||||
|
search: String = "",
|
||||||
|
includeRead: Boolean,
|
||||||
|
endless: Boolean,
|
||||||
|
offset: Int,
|
||||||
|
isResuming: Boolean,
|
||||||
|
) = db.get()
|
||||||
|
.listOfObjects(MangaChapterHistory::class.java)
|
||||||
|
.withQuery(
|
||||||
|
RawQuery.builder()
|
||||||
|
.query(
|
||||||
|
getAllRecentsType(
|
||||||
|
search.sqLite,
|
||||||
|
includeRead,
|
||||||
|
endless,
|
||||||
|
offset,
|
||||||
|
isResuming,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// .args(date.time, startDate.time)
|
||||||
|
.observesTables(HistoryTable.TABLE)
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
.withGetResolver(MangaChapterHistoryGetResolver.INSTANCE)
|
||||||
|
.prepare()
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BaseCoroutinePresenter
|
import eu.kanade.tachiyomi.ui.base.presenter.BaseCoroutinePresenter
|
||||||
import eu.kanade.tachiyomi.util.chapter.ChapterFilter
|
import eu.kanade.tachiyomi.util.chapter.ChapterFilter
|
||||||
import eu.kanade.tachiyomi.util.chapter.ChapterSort
|
import eu.kanade.tachiyomi.util.chapter.ChapterSort
|
||||||
|
import eu.kanade.tachiyomi.util.system.executeOnIO
|
||||||
import eu.kanade.tachiyomi.util.system.launchIO
|
import eu.kanade.tachiyomi.util.system.launchIO
|
||||||
import eu.kanade.tachiyomi.util.system.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
|
@ -171,6 +172,8 @@ class RecentsPresenter(
|
||||||
var extraCount = 0
|
var extraCount = 0
|
||||||
val cReading: List<MangaChapterHistory> = when (viewType) {
|
val cReading: List<MangaChapterHistory> = when (viewType) {
|
||||||
RecentsViewType.GroupedAll, RecentsViewType.UngroupedAll -> {
|
RecentsViewType.GroupedAll, RecentsViewType.UngroupedAll -> {
|
||||||
|
// FIXME
|
||||||
|
/*
|
||||||
getRecents.awaitAll(
|
getRecents.awaitAll(
|
||||||
showRead,
|
showRead,
|
||||||
true,
|
true,
|
||||||
|
@ -179,6 +182,14 @@ class RecentsPresenter(
|
||||||
query,
|
query,
|
||||||
(if (isCustom) ENDLESS_LIMIT else pageOffset).toLong(),
|
(if (isCustom) ENDLESS_LIMIT else pageOffset).toLong(),
|
||||||
)
|
)
|
||||||
|
*/
|
||||||
|
db.getAllRecentsTypes(
|
||||||
|
query,
|
||||||
|
showRead,
|
||||||
|
isEndless,
|
||||||
|
if (isCustom) ENDLESS_LIMIT else pageOffset,
|
||||||
|
!updatePageCount && !isOnFirstPage,
|
||||||
|
).executeOnIO()
|
||||||
}
|
}
|
||||||
RecentsViewType.History -> {
|
RecentsViewType.History -> {
|
||||||
val items = if (groupChaptersHistory == GroupType.BySeries) {
|
val items = if (groupChaptersHistory == GroupType.BySeries) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ AND (
|
||||||
ORDER BY max_last_read.history_last_read DESC
|
ORDER BY max_last_read.history_last_read DESC
|
||||||
LIMIT :limit OFFSET :offset;
|
LIMIT :limit OFFSET :offset;
|
||||||
|
|
||||||
getRecentsAll: -- AKA insanity
|
getRecentsAll: -- FIXME: This is insanity, require refactoring
|
||||||
SELECT * FROM (
|
SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
mangas.*,
|
mangas.*,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue