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