feat: 优化

pull/241/head
gedoor 5 years ago
parent 64be7259f6
commit c493fb894d
  1. 4
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -12,6 +12,7 @@ import io.legado.app.help.BookHelp
import io.legado.app.model.WebBook import io.legado.app.model.WebBook
import io.legado.app.model.localBook.AnalyzeTxtFile import io.legado.app.model.localBook.AnalyzeTxtFile
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
import io.legado.app.service.help.ReadBook
import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.Dispatchers.IO
class BookInfoViewModel(application: Application) : BaseViewModel(application) { class BookInfoViewModel(application: Application) : BaseViewModel(application) {
@ -178,6 +179,9 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
book.durChapterTitle = it.durChapterTitle book.durChapterTitle = it.durChapterTitle
} }
App.db.bookDao().insert(book) App.db.bookDao().insert(book)
if (ReadBook.book?.name == book.name && ReadBook.book?.author == book.author) {
ReadBook.book = book
}
} }
}.onSuccess { }.onSuccess {
success?.invoke() success?.invoke()

Loading…
Cancel
Save