Reader: Save reading progress with SQLDelight (#7185)
* Use SQLDelight in reader to update history * Move chapter progress to sqldelight * Review Changes Co-Authored-By: inorichi <len@kanade.eu> * Review Changes 2 Co-authored-by: FourTOne5 <59261191+FourTOne5@users.noreply.github.com> Co-authored-by: inorichi <len@kanade.eu>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package eu.kanade.data.chapter
|
||||
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.data.toLong
|
||||
import eu.kanade.domain.chapter.model.ChapterUpdate
|
||||
import eu.kanade.domain.chapter.repository.ChapterRepository
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import logcat.LogPriority
|
||||
|
||||
class ChapterRepositoryImpl(
|
||||
private val databaseHandler: DatabaseHandler,
|
||||
) : ChapterRepository {
|
||||
|
||||
override suspend fun update(chapterUpdate: ChapterUpdate) {
|
||||
try {
|
||||
databaseHandler.await {
|
||||
chaptersQueries.update(
|
||||
chapterUpdate.mangaId,
|
||||
chapterUpdate.url,
|
||||
chapterUpdate.name,
|
||||
chapterUpdate.scanlator,
|
||||
chapterUpdate.read?.toLong(),
|
||||
chapterUpdate.bookmark?.toLong(),
|
||||
chapterUpdate.lastPageRead,
|
||||
chapterUpdate.chapterNumber?.toDouble(),
|
||||
chapterUpdate.sourceOrder,
|
||||
chapterUpdate.dateFetch,
|
||||
chapterUpdate.dateUpload,
|
||||
chapterId = chapterUpdate.id,
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user