diff --git a/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt b/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt index a38fa15d9..dff07d1ab 100644 --- a/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt @@ -7,8 +7,8 @@ import io.legado.app.data.entities.RssArticle @Dao interface RssArticleDao { - @Query("select * from rssArticles where origin = :origin and title = :title") - fun get(origin: String, title: String): RssArticle? + @Query("select * from rssArticles where origin = :origin and link = :link") + fun get(origin: String, link: String): RssArticle? @Query("select * from rssArticles where origin = :origin order by `order` desc") fun liveByOrigin(origin: String): LiveData> diff --git a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt index e3810036f..b44949155 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt @@ -6,7 +6,7 @@ import androidx.room.Ignore @Entity( tableName = "rssArticles", - primaryKeys = ["origin", "title"] + primaryKeys = ["origin", "link"] ) data class RssArticle( var origin: String = "", diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt index 6e3ac4318..8e32ad867 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesActivity.kt @@ -122,7 +122,7 @@ class RssArticlesActivity : VMBaseActivity(R.layout.activi viewModel.read(rssArticle) startActivity( Pair("origin", rssArticle.origin), - Pair("title", rssArticle.title) + Pair("link", rssArticle.link) ) } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt index a8c0d2963..c50127ebd 100644 --- a/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/read/ReadRssViewModel.kt @@ -20,13 +20,13 @@ class ReadRssViewModel(application: Application) : BaseViewModel(application) { fun initData(intent: Intent) { execute { val origin = intent.getStringExtra("origin") - val title = intent.getStringExtra("title") + val link = intent.getStringExtra("link") val rssSource = App.db.rssSourceDao().getByKey(origin) rssSource?.let { rssSourceLiveData.postValue(it) } - if (origin != null && title != null) { - App.db.rssArticleDao().get(origin, title)?.let { rssArticle -> + if (origin != null && link != null) { + App.db.rssArticleDao().get(origin, link)?.let { rssArticle -> rssArticleLiveData.postValue(rssArticle) if (!rssArticle.description.isNullOrBlank()) { contentLiveData.postValue(rssArticle.description)