mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
a5fbce7963
commit
c4f3b1a19e
@ -32,18 +32,12 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
|
||||
if (it.isJson()) {
|
||||
//暂时根据文件内容判断属于什么
|
||||
when {
|
||||
content.contains("bookSourceUrl") -> {
|
||||
content.contains("bookSourceUrl") ->
|
||||
importBookSourceLive.postValue(it)
|
||||
return@execute
|
||||
}
|
||||
content.contains("sourceUrl") -> {
|
||||
content.contains("sourceUrl") ->
|
||||
importRssSourceLive.postValue(it)
|
||||
return@execute
|
||||
}
|
||||
content.contains("pattern") -> {
|
||||
content.contains("pattern") ->
|
||||
importReplaceRuleLive.postValue(it)
|
||||
return@execute
|
||||
}
|
||||
content.contains("themeName") ->
|
||||
importTheme(content, finally)
|
||||
content.contains("name") && content.contains("rule") ->
|
||||
@ -52,9 +46,10 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo
|
||||
importHttpTTS(content, finally)
|
||||
else -> errorLiveData.postValue("格式不对")
|
||||
}
|
||||
} else {
|
||||
val book = LocalBook.importFile(uri)
|
||||
openBookLiveData.postValue(book.bookUrl)
|
||||
}
|
||||
val book = LocalBook.importFile(uri)
|
||||
openBookLiveData.postValue(book.bookUrl)
|
||||
} ?: throw NoStackTraceException("文件不存在")
|
||||
} else {
|
||||
onLineImportLive.postValue(uri)
|
||||
|
Loading…
Reference in New Issue
Block a user