|
|
@ -47,8 +47,7 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), |
|
|
|
rssSource = appDb.rssSourceDao.getByKey(origin) |
|
|
|
rssSource = appDb.rssSourceDao.getByKey(origin) |
|
|
|
if (link != null) { |
|
|
|
if (link != null) { |
|
|
|
rssStar = appDb.rssStarDao.get(origin, link) |
|
|
|
rssStar = appDb.rssStarDao.get(origin, link) |
|
|
|
rssArticle = appDb.rssArticleDao.get(origin, link) |
|
|
|
rssArticle = rssStar?.toRssArticle() ?: appDb.rssArticleDao.get(origin, link) |
|
|
|
//rssArticle = rssStar?.toRssArticle() ?: appDb.rssArticleDao.get(origin, link) |
|
|
|
|
|
|
|
rssArticle?.let { rssArticle -> |
|
|
|
rssArticle?.let { rssArticle -> |
|
|
|
if (!rssArticle.description.isNullOrBlank()) { |
|
|
|
if (!rssArticle.description.isNullOrBlank()) { |
|
|
|
contentLiveData.postValue(rssArticle.description!!) |
|
|
|
contentLiveData.postValue(rssArticle.description!!) |
|
|
@ -106,6 +105,19 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun refresh() { |
|
|
|
|
|
|
|
rssArticle?.let { rssArticle -> |
|
|
|
|
|
|
|
rssSource?.let { |
|
|
|
|
|
|
|
val ruleContent = it.ruleContent |
|
|
|
|
|
|
|
if (!ruleContent.isNullOrBlank()) { |
|
|
|
|
|
|
|
loadContent(rssArticle, ruleContent) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
loadUrl(rssArticle.link, rssArticle.origin) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} ?: loadUrl(rssArticle.link, rssArticle.origin) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun favorite() { |
|
|
|
fun favorite() { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
rssStar?.let { |
|
|
|
rssStar?.let { |
|
|
|