优化
This commit is contained in:
@@ -858,21 +858,25 @@ object ReadBook : CoroutineScope by MainScope() {
|
|||||||
|
|
||||||
fun saveRead(pageChanged: Boolean = false) {
|
fun saveRead(pageChanged: Boolean = false) {
|
||||||
executor.execute {
|
executor.execute {
|
||||||
val book = book ?: return@execute
|
kotlin.runCatching {
|
||||||
book.lastCheckCount = 0
|
val book = book ?: return@execute
|
||||||
book.durChapterTime = System.currentTimeMillis()
|
book.lastCheckCount = 0
|
||||||
val chapterChanged = book.durChapterIndex != durChapterIndex
|
book.durChapterTime = System.currentTimeMillis()
|
||||||
book.durChapterIndex = durChapterIndex
|
val chapterChanged = book.durChapterIndex != durChapterIndex
|
||||||
book.durChapterPos = durChapterPos
|
book.durChapterIndex = durChapterIndex
|
||||||
if (!pageChanged || chapterChanged) {
|
book.durChapterPos = durChapterPos
|
||||||
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
|
if (!pageChanged || chapterChanged) {
|
||||||
book.durChapterTitle = it.getDisplayTitle(
|
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
|
||||||
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
|
book.durChapterTitle = it.getDisplayTitle(
|
||||||
book.getUseReplaceRule()
|
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
|
||||||
)
|
book.getUseReplaceRule()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
appDb.bookDao.update(book)
|
||||||
|
}.onFailure {
|
||||||
|
AppLog.put("保存书籍阅读进度信息出错\n$it", it)
|
||||||
}
|
}
|
||||||
appDb.bookDao.update(book)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -327,21 +327,25 @@ object ReadManga : CoroutineScope by MainScope() {
|
|||||||
|
|
||||||
fun saveRead(pageChanged: Boolean = false) {
|
fun saveRead(pageChanged: Boolean = false) {
|
||||||
executor.execute {
|
executor.execute {
|
||||||
val book = book ?: return@execute
|
kotlin.runCatching {
|
||||||
book.lastCheckCount = 0
|
val book = book ?: return@execute
|
||||||
book.durChapterTime = System.currentTimeMillis()
|
book.lastCheckCount = 0
|
||||||
val chapterChanged = book.durChapterIndex != durChapterIndex
|
book.durChapterTime = System.currentTimeMillis()
|
||||||
book.durChapterIndex = durChapterIndex
|
val chapterChanged = book.durChapterIndex != durChapterIndex
|
||||||
book.durChapterPos = durChapterPos
|
book.durChapterIndex = durChapterIndex
|
||||||
if (!pageChanged || chapterChanged) {
|
book.durChapterPos = durChapterPos
|
||||||
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
|
if (!pageChanged || chapterChanged) {
|
||||||
book.durChapterTitle = it.getDisplayTitle(
|
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
|
||||||
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
|
book.durChapterTitle = it.getDisplayTitle(
|
||||||
book.getUseReplaceRule()
|
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
|
||||||
)
|
book.getUseReplaceRule()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
appDb.bookDao.update(book)
|
||||||
|
}.onFailure {
|
||||||
|
AppLog.put("保存漫画阅读进度信息出错\n$it", it)
|
||||||
}
|
}
|
||||||
appDb.bookDao.update(book)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user