pull/35/head^2
kunfei 5 years ago
parent ff2800ce0a
commit 1c74f48d53
  1. 4
      app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt

@ -6,6 +6,7 @@ import io.legado.app.App
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
import io.legado.app.data.entities.RssSource import io.legado.app.data.entities.RssSource
import io.legado.app.model.Rss import io.legado.app.model.Rss
import kotlinx.coroutines.Dispatchers.IO
class RssArticlesViewModel(application: Application) : BaseViewModel(application) { class RssArticlesViewModel(application: Application) : BaseViewModel(application) {
@ -20,7 +21,8 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application
} else { } else {
titleLiveData.postValue(rssSource.sourceName) titleLiveData.postValue(rssSource.sourceName)
} }
Rss.getArticles(rssSource, this).onSuccess { Rss.getArticles(rssSource, this)
.onSuccess(IO) {
it?.let { it?.let {
App.db.rssArtivleDao().insert(*it.toTypedArray()) App.db.rssArtivleDao().insert(*it.toTypedArray())
} }

Loading…
Cancel
Save