|
|
@ -20,13 +20,13 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
fun initData(intent: Intent) { |
|
|
|
fun initData(intent: Intent) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
val origin = intent.getStringExtra("origin") |
|
|
|
val origin = intent.getStringExtra("origin") |
|
|
|
val title = intent.getStringExtra("title") |
|
|
|
val link = intent.getStringExtra("link") |
|
|
|
val rssSource = App.db.rssSourceDao().getByKey(origin) |
|
|
|
val rssSource = App.db.rssSourceDao().getByKey(origin) |
|
|
|
rssSource?.let { |
|
|
|
rssSource?.let { |
|
|
|
rssSourceLiveData.postValue(it) |
|
|
|
rssSourceLiveData.postValue(it) |
|
|
|
} |
|
|
|
} |
|
|
|
if (origin != null && title != null) { |
|
|
|
if (origin != null && link != null) { |
|
|
|
App.db.rssArticleDao().get(origin, title)?.let { rssArticle -> |
|
|
|
App.db.rssArticleDao().get(origin, link)?.let { rssArticle -> |
|
|
|
rssArticleLiveData.postValue(rssArticle) |
|
|
|
rssArticleLiveData.postValue(rssArticle) |
|
|
|
if (!rssArticle.description.isNullOrBlank()) { |
|
|
|
if (!rssArticle.description.isNullOrBlank()) { |
|
|
|
contentLiveData.postValue(rssArticle.description) |
|
|
|
contentLiveData.postValue(rssArticle.description) |
|
|
|