mirror of
https://github.com/gedoor/legado.git
synced 2024-09-03 09:55:00 +08:00
优化
This commit is contained in:
parent
456fb0c9f0
commit
6db517eaa1
@ -15,7 +15,6 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
|
|||||||
val openBookLiveData = MutableLiveData<String>()
|
val openBookLiveData = MutableLiveData<String>()
|
||||||
val notSupportedLiveData = MutableLiveData<Pair<Uri, String>>()
|
val notSupportedLiveData = MutableLiveData<Pair<Uri, String>>()
|
||||||
|
|
||||||
@Suppress("BlockingMethodInNonBlockingContext")
|
|
||||||
fun dispatchIndent(uri: Uri) {
|
fun dispatchIndent(uri: Uri) {
|
||||||
execute {
|
execute {
|
||||||
lateinit var fileName: String
|
lateinit var fileName: String
|
||||||
@ -42,7 +41,7 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dispatch(fileDoc: FileDoc) {
|
private fun dispatch(fileDoc: FileDoc) {
|
||||||
kotlin.runCatching {
|
kotlin.runCatching {
|
||||||
if (fileDoc.openInputStream().getOrNull().isJson()) {
|
if (fileDoc.openInputStream().getOrNull().isJson()) {
|
||||||
importJson(fileDoc.uri)
|
importJson(fileDoc.uri)
|
||||||
|
@ -25,7 +25,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun upBookTocRule(book: Book, finally: () -> Unit) {
|
fun upBookTocRule(book: Book, finally: () -> Unit) {
|
||||||
execute {
|
|
||||||
execute {
|
execute {
|
||||||
appDb.bookDao.update(book)
|
appDb.bookDao.update(book)
|
||||||
LocalBook.getChapterList(book).let {
|
LocalBook.getChapterList(book).let {
|
||||||
@ -35,7 +34,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
appDb.bookDao.update(book)
|
appDb.bookDao.update(book)
|
||||||
bookData.postValue(book)
|
bookData.postValue(book)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}.onFinally {
|
}.onFinally {
|
||||||
finally.invoke()
|
finally.invoke()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user