|
|
|
@ -4,7 +4,6 @@ import android.app.Application |
|
|
|
|
import android.net.Uri |
|
|
|
|
import androidx.documentfile.provider.DocumentFile |
|
|
|
|
import androidx.lifecycle.MutableLiveData |
|
|
|
|
import io.legado.app.constant.AppPattern.bookFileRegex |
|
|
|
|
import io.legado.app.exception.NoStackTraceException |
|
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
|
import io.legado.app.utils.isJson |
|
|
|
@ -47,12 +46,7 @@ class FileAssociationViewModel(application: Application) : BaseAssociationViewMo |
|
|
|
|
importHttpTTS(content, finally) |
|
|
|
|
else -> errorLiveData.postValue("格式不对") |
|
|
|
|
} |
|
|
|
|
(uri.path ?: uri.toString()).matches(bookFileRegex) -> { |
|
|
|
|
importBookLiveData.postValue(uri) |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
throw NoStackTraceException("暂未支持的本地书籍格式(TXT/UMD/EPUB)") |
|
|
|
|
} |
|
|
|
|
else -> importBookLiveData.postValue(uri) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
onLineImportLive.postValue(uri) |
|
|
|
|