pull/83/head
kunfei 5 years ago
parent 8d52168468
commit bee89db3dd
  1. 8
      app/src/main/java/io/legado/app/ui/main/MainViewModel.kt

@ -4,13 +4,11 @@ import android.app.Application
import io.legado.app.App
import io.legado.app.base.BaseViewModel
import io.legado.app.constant.Bus
import io.legado.app.data.api.IHttpGetApi
import io.legado.app.data.entities.RssSource
import io.legado.app.help.http.HttpHelper
import io.legado.app.help.storage.Restore
import io.legado.app.model.WebBook
import io.legado.app.utils.GSON
import io.legado.app.utils.NetworkUtils
import io.legado.app.utils.fromJsonObject
import io.legado.app.utils.postEvent
import kotlinx.coroutines.Dispatchers.IO
@ -58,10 +56,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
fun initRss() {
execute {
val url = "https://gitee.com/alanskycn/yuedu/raw/master/JS/RSS/rssSource"
NetworkUtils.getBaseUrl(url)?.let {
val response =
HttpHelper.getApiService<IHttpGetApi>(it).getAsync(url, mapOf()).await()
response.body()?.let { body ->
HttpHelper.simpleGet(url)?.let { body ->
val sources = mutableListOf<RssSource>()
val items: List<Map<String, Any>> = Restore.jsonPath.parse(body).read("$")
for (item in items) {
@ -75,4 +70,3 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
}
}
}
}
Loading…
Cancel
Save