|
|
@ -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() |
|
|
|