Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Jan 21, 2024
1 parent 5cf7369 commit 325b500
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
3 changes: 0 additions & 3 deletions app/src/main/java/io/legado/app/data/dao/BookDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ interface BookDao {
@Query("SELECT * FROM books WHERE bookUrl = :bookUrl")
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")
fun getBook(name: String, author: String): Book?

Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/io/legado/app/model/ReadBook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import io.legado.app.model.webBook.WebBook
import io.legado.app.service.BaseReadAloudService
import io.legado.app.ui.book.read.page.entities.TextChapter
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.toastOnUi
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -209,7 +208,6 @@ object ReadBook : CoroutineScope by MainScope() {
prevTextChapter = curTextChapter
curTextChapter = nextTextChapter
nextTextChapter = null
LogUtils.d("moveToNextChapter", "title ${curTextChapter?.chapter?.title}")
if (curTextChapter == null) {
AppLog.putDebug("moveToNextChapter-章节未加载,开始加载")
callBack?.upContent()
Expand Down Expand Up @@ -240,7 +238,6 @@ object ReadBook : CoroutineScope by MainScope() {
nextTextChapter = curTextChapter
curTextChapter = prevTextChapter
prevTextChapter = null
LogUtils.d("moveToPrevChapter", "title ${curTextChapter?.chapter?.title}")
if (curTextChapter == null) {
callBack?.upContent()
loadContent(durChapterIndex, upContent, resetPageOffset = false)
Expand Down Expand Up @@ -538,10 +535,7 @@ object ReadBook : CoroutineScope by MainScope() {
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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import io.legado.app.ui.widget.dialog.VariableDialog
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.ColorUtils
import io.legado.app.utils.GSON
import io.legado.app.utils.LogUtils
import io.legado.app.utils.StartActivityContract
import io.legado.app.utils.dpToPx
import io.legado.app.utils.gone
Expand Down Expand Up @@ -301,7 +300,6 @@ class BookInfoActivity :

private fun showBook(book: Book) = binding.run {
showCover(book)
LogUtils.d("showBook", "latest ${book.latestChapterTitle}")
tvName.text = book.name
tvAuthor.text = getString(R.string.author_show, book.getRealAuthor())
tvOrigin.text = getString(R.string.origin_show, book.originName)
Expand Down Expand Up @@ -342,8 +340,6 @@ class BookInfoActivity :

else -> {
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.tvLasted.text = getString(R.string.lasted_show, it.latestChapterTitle)
}
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.model.localBook.LocalBook
import io.legado.app.model.webBook.WebBook
import io.legado.app.utils.ArchiveUtils
import io.legado.app.utils.LogUtils
import io.legado.app.utils.UrlUtil
import io.legado.app.utils.isContentScheme
import io.legado.app.utils.postEvent
import io.legado.app.utils.toastOnUi
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.launch

class BookInfoViewModel(application: Application) : BaseViewModel(application) {
val bookData = MutableLiveData<Book>()
Expand All @@ -59,7 +57,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
val bookUrl = intent.getStringExtra("bookUrl") ?: ""
appDb.bookDao.getBook(name, author)?.let {
inBookshelf = true
LogUtils.d("BookInfoViewModel initData", "book ${it.name}")
upBook(it)
return@execute
}
Expand Down Expand Up @@ -92,16 +89,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {

private fun upBook(book: Book) {
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)
upCoverByRule(book)
bookSource = if (book.isLocal) null else
Expand Down

0 comments on commit 325b500

Please sign in to comment.