This commit is contained in:
Horis 2023-04-30 12:40:47 +08:00
parent 456fb0c9f0
commit 6db517eaa1
2 changed files with 7 additions and 10 deletions

View File

@ -15,7 +15,6 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
val openBookLiveData = MutableLiveData<String>()
val notSupportedLiveData = MutableLiveData<Pair<Uri, String>>()
@Suppress("BlockingMethodInNonBlockingContext")
fun dispatchIndent(uri: Uri) {
execute {
lateinit var fileName: String
@ -42,7 +41,7 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
}
}
fun dispatch(fileDoc: FileDoc) {
private fun dispatch(fileDoc: FileDoc) {
kotlin.runCatching {
if (fileDoc.openInputStream().getOrNull().isJson()) {
importJson(fileDoc.uri)

View File

@ -26,15 +26,13 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
fun upBookTocRule(book: Book, finally: () -> Unit) {
execute {
execute {
appDb.bookDao.update(book)
LocalBook.getChapterList(book).let {
book.latestChapterTime = System.currentTimeMillis()
appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray())
appDb.bookDao.update(book)
LocalBook.getChapterList(book).let {
book.latestChapterTime = System.currentTimeMillis()
appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray())
appDb.bookDao.update(book)
bookData.postValue(book)
}
bookData.postValue(book)
}
}.onFinally {
finally.invoke()