Merge branch 'gedoor:master' into master

pull/1121/head
bushixuanqi 3 years ago committed by GitHub
commit 3ad75d0443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/src/main/java/io/legado/app/api/ReaderProvider.kt

@ -20,7 +20,7 @@ import java.util.*
class ReaderProvider : ContentProvider() { class ReaderProvider : ContentProvider() {
private enum class RequestCode { private enum class RequestCode {
SaveSource, SaveSources, SaveBook, DeleteSources, GetSource, GetSources, SaveSource, SaveSources, SaveBook, DeleteSources, GetSource, GetSources,
GetBookshelf, RefreshToc, GetChapterList, GetBookContent GetBookshelf, RefreshToc, GetChapterList, GetBookContent, GetBookCover
} }
private val postBodyKey = "json" private val postBodyKey = "json"
@ -37,6 +37,7 @@ class ReaderProvider : ContentProvider() {
addURI(authority, "book/refreshToc/query", RequestCode.RefreshToc.ordinal) addURI(authority, "book/refreshToc/query", RequestCode.RefreshToc.ordinal)
addURI(authority, "book/chapter/query", RequestCode.GetChapterList.ordinal) addURI(authority, "book/chapter/query", RequestCode.GetChapterList.ordinal)
addURI(authority, "book/content/query", RequestCode.GetBookContent.ordinal) addURI(authority, "book/content/query", RequestCode.GetBookContent.ordinal)
addURI(authority, "book/cover/query", RequestCode.GetBookCover.ordinal)
} }
} }
} }
@ -90,6 +91,9 @@ class ReaderProvider : ContentProvider() {
uri.getQueryParameter("index")?.let { uri.getQueryParameter("index")?.let {
map["index"] = arrayListOf(it) map["index"] = arrayListOf(it)
} }
uri.getQueryParameter("path")?.let {
map["path"] = arrayListOf(it)
}
return if (sMatcher.match(uri) < 0) null else when (RequestCode.values()[sMatcher.match(uri)]) { return if (sMatcher.match(uri) < 0) null else when (RequestCode.values()[sMatcher.match(uri)]) {
RequestCode.GetSource -> SimpleCursor(SourceController.getSource(map)) RequestCode.GetSource -> SimpleCursor(SourceController.getSource(map))
RequestCode.GetSources -> SimpleCursor(SourceController.sources) RequestCode.GetSources -> SimpleCursor(SourceController.sources)
@ -97,6 +101,7 @@ class ReaderProvider : ContentProvider() {
RequestCode.GetBookContent -> SimpleCursor(BookController.getBookContent(map)) RequestCode.GetBookContent -> SimpleCursor(BookController.getBookContent(map))
RequestCode.RefreshToc -> SimpleCursor(BookController.refreshToc(map)) RequestCode.RefreshToc -> SimpleCursor(BookController.refreshToc(map))
RequestCode.GetChapterList -> SimpleCursor(BookController.getChapterList(map)) RequestCode.GetChapterList -> SimpleCursor(BookController.getChapterList(map))
RequestCode.GetBookCover -> SimpleCursor(BookController.getCover(map))
else -> throw IllegalStateException( else -> throw IllegalStateException(
"Unexpected value: " + RequestCode.values()[sMatcher.match(uri)].name "Unexpected value: " + RequestCode.values()[sMatcher.match(uri)].name
) )

Loading…
Cancel
Save