This commit is contained in:
Horis
2024-01-21 15:03:43 +08:00
parent 5cf73698a8
commit 325b500c85
4 changed files with 0 additions and 26 deletions
@@ -84,9 +84,6 @@ interface BookDao {
@Query("SELECT * FROM books WHERE bookUrl = :bookUrl") @Query("SELECT * FROM books WHERE bookUrl = :bookUrl")
fun getBook(bookUrl: String): Book? fun getBook(bookUrl: String): Book?
@Query("SELECT * FROM books WHERE bookUrl = :bookUrl")
fun getBookFlow(bookUrl: String): Flow<Book?>
@Query("SELECT * FROM books WHERE name = :name and author = :author") @Query("SELECT * FROM books WHERE name = :name and author = :author")
fun getBook(name: String, author: String): Book? fun getBook(name: String, author: String): Book?
@@ -19,7 +19,6 @@ import io.legado.app.model.webBook.WebBook
import io.legado.app.service.BaseReadAloudService import io.legado.app.service.BaseReadAloudService
import io.legado.app.ui.book.read.page.entities.TextChapter import io.legado.app.ui.book.read.page.entities.TextChapter
import io.legado.app.ui.book.read.page.provider.ChapterProvider import io.legado.app.ui.book.read.page.provider.ChapterProvider
import io.legado.app.utils.LogUtils
import io.legado.app.utils.stackTraceStr import io.legado.app.utils.stackTraceStr
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@@ -209,7 +208,6 @@ object ReadBook : CoroutineScope by MainScope() {
prevTextChapter = curTextChapter prevTextChapter = curTextChapter
curTextChapter = nextTextChapter curTextChapter = nextTextChapter
nextTextChapter = null nextTextChapter = null
LogUtils.d("moveToNextChapter", "title ${curTextChapter?.chapter?.title}")
if (curTextChapter == null) { if (curTextChapter == null) {
AppLog.putDebug("moveToNextChapter-章节未加载,开始加载") AppLog.putDebug("moveToNextChapter-章节未加载,开始加载")
callBack?.upContent() callBack?.upContent()
@@ -240,7 +238,6 @@ object ReadBook : CoroutineScope by MainScope() {
nextTextChapter = curTextChapter nextTextChapter = curTextChapter
curTextChapter = prevTextChapter curTextChapter = prevTextChapter
prevTextChapter = null prevTextChapter = null
LogUtils.d("moveToPrevChapter", "title ${curTextChapter?.chapter?.title}")
if (curTextChapter == null) { if (curTextChapter == null) {
callBack?.upContent() callBack?.upContent()
loadContent(durChapterIndex, upContent, resetPageOffset = false) loadContent(durChapterIndex, upContent, resetPageOffset = false)
@@ -538,10 +535,7 @@ object ReadBook : CoroutineScope by MainScope() {
book.getUseReplaceRule() book.getUseReplaceRule()
) )
} }
LogUtils.d("saveRead", "dur ${book.durChapterTitle}")
} }
LogUtils.d("bookDao", "saveRead update latest ${book.latestChapterTitle}")
LogUtils.d("bookDao", "saveRead update dur ${book.durChapterTitle}")
appDb.bookDao.update(book) appDb.bookDao.update(book)
} }
} }
@@ -53,7 +53,6 @@ import io.legado.app.ui.widget.dialog.VariableDialog
import io.legado.app.ui.widget.dialog.WaitDialog import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.ColorUtils import io.legado.app.utils.ColorUtils
import io.legado.app.utils.GSON import io.legado.app.utils.GSON
import io.legado.app.utils.LogUtils
import io.legado.app.utils.StartActivityContract import io.legado.app.utils.StartActivityContract
import io.legado.app.utils.dpToPx import io.legado.app.utils.dpToPx
import io.legado.app.utils.gone import io.legado.app.utils.gone
@@ -301,7 +300,6 @@ class BookInfoActivity :
private fun showBook(book: Book) = binding.run { private fun showBook(book: Book) = binding.run {
showCover(book) showCover(book)
LogUtils.d("showBook", "latest ${book.latestChapterTitle}")
tvName.text = book.name tvName.text = book.name
tvAuthor.text = getString(R.string.author_show, book.getRealAuthor()) tvAuthor.text = getString(R.string.author_show, book.getRealAuthor())
tvOrigin.text = getString(R.string.origin_show, book.originName) tvOrigin.text = getString(R.string.origin_show, book.originName)
@@ -342,8 +340,6 @@ class BookInfoActivity :
else -> { else -> {
book?.let { book?.let {
LogUtils.d("upLoading", "latest ${it.latestChapterTitle}")
LogUtils.d("upLoading", "dur ${it.durChapterTitle}")
binding.tvToc.text = getString(R.string.toc_s, it.durChapterTitle) binding.tvToc.text = getString(R.string.toc_s, it.durChapterTitle)
binding.tvLasted.text = getString(R.string.lasted_show, it.latestChapterTitle) binding.tvLasted.text = getString(R.string.lasted_show, it.latestChapterTitle)
} }
@@ -33,14 +33,12 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.model.webBook.WebBook import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.ArchiveUtils import io.legado.app.utils.ArchiveUtils
import io.legado.app.utils.LogUtils
import io.legado.app.utils.UrlUtil import io.legado.app.utils.UrlUtil
import io.legado.app.utils.isContentScheme import io.legado.app.utils.isContentScheme
import io.legado.app.utils.postEvent import io.legado.app.utils.postEvent
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch
class BookInfoViewModel(application: Application) : BaseViewModel(application) { class BookInfoViewModel(application: Application) : BaseViewModel(application) {
val bookData = MutableLiveData<Book>() val bookData = MutableLiveData<Book>()
@@ -59,7 +57,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
val bookUrl = intent.getStringExtra("bookUrl") ?: "" val bookUrl = intent.getStringExtra("bookUrl") ?: ""
appDb.bookDao.getBook(name, author)?.let { appDb.bookDao.getBook(name, author)?.let {
inBookshelf = true inBookshelf = true
LogUtils.d("BookInfoViewModel initData", "book ${it.name}")
upBook(it) upBook(it)
return@execute return@execute
} }
@@ -92,16 +89,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
private fun upBook(book: Book) { private fun upBook(book: Book) {
execute { execute {
launch {
appDb.bookDao.getBookFlow(book.bookUrl).collect { book ->
book?.let {
LogUtils.d("getBookFlow", "name ${it.name}")
LogUtils.d("getBookFlow", "use replace ${it.getUseReplaceRule()}")
LogUtils.d("getBookFlow", "latest ${it.latestChapterTitle}")
LogUtils.d("getBookFlow", "dur ${it.durChapterTitle}")
}
}
}
bookData.postValue(book) bookData.postValue(book)
upCoverByRule(book) upCoverByRule(book)
bookSource = if (book.isLocal) null else bookSource = if (book.isLocal) null else