ReaderProvider.kt: Modify initial process of `sMatcher`

Signed-off-by: 1552980358 <1552980358@qq.com>
pull/366/head
1552980358 4 years ago
parent b324df7095
commit ab38641a9d
  1. 25
      app/src/main/java/io/legado/app/api/ReaderProvider.kt

@ -29,18 +29,19 @@ class ReaderProvider : ContentProvider() {
private val postBodyKey = "json"
private val sMatcher by lazy {
val uriMatcher = UriMatcher(UriMatcher.NO_MATCH)
val authority = "${context?.applicationInfo?.packageName}.readerProvider"
uriMatcher.addURI(authority, "source/insert", RequestCode.saveSource.ordinal)
uriMatcher.addURI(authority, "sources/insert", RequestCode.saveSources.ordinal)
uriMatcher.addURI(authority, "book/insert", RequestCode.saveBook.ordinal)
uriMatcher.addURI(authority, "sources/delete", RequestCode.deleteSources.ordinal)
uriMatcher.addURI(authority, "source/query", RequestCode.getSource.ordinal)
uriMatcher.addURI(authority, "sources/query", RequestCode.getSources.ordinal)
uriMatcher.addURI(authority, "books/query", RequestCode.getBookshelf.ordinal)
uriMatcher.addURI(authority, "book/chapter/query", RequestCode.getChapterList.ordinal)
uriMatcher.addURI(authority, "book/content/query", RequestCode.getBookContent.ordinal)
return@lazy uriMatcher
UriMatcher(UriMatcher.NO_MATCH).apply {
"${context?.applicationInfo?.packageName}.readerProvider".also { authority ->
addURI(authority, "source/insert", RequestCode.saveSource.ordinal)
addURI(authority, "sources/insert", RequestCode.saveSources.ordinal)
addURI(authority, "book/insert", RequestCode.saveBook.ordinal)
addURI(authority, "sources/delete", RequestCode.deleteSources.ordinal)
addURI(authority, "source/query", RequestCode.getSource.ordinal)
addURI(authority, "sources/query", RequestCode.getSources.ordinal)
addURI(authority, "books/query", RequestCode.getBookshelf.ordinal)
addURI(authority, "book/chapter/query", RequestCode.getChapterList.ordinal)
addURI(authority, "book/content/query", RequestCode.getBookContent.ordinal)
}
}
}
override fun onCreate(): Boolean {

Loading…
Cancel
Save