From 49d1c9f40f67a92ca1c8532bfcd2b09450311ec3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 4 Apr 2020 21:00:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/data/dao/RssArticleDao.kt | 4 ++-- app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt | 2 +- .../java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 85c8ef9c3..10bf63933 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 @@ -22,8 +22,8 @@ interface RssArticleDao { @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(vararg rssArticle: RssArticle) - @Query("delete from rssArticles where origin = :origin and `order` < :order") - fun clearOld(origin: String, order: Long) + @Query("delete from rssArticles where origin = :origin and sort = :sort and `order` < :order") + fun clearOld(origin: String, sort: String, order: Long) @Update fun update(vararg rssArticle: RssArticle) diff --git a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt index 06a420991..cd90b6b1d 100644 --- a/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt +++ b/app/src/main/java/io/legado/app/model/rss/RssParserByRule.kt @@ -60,7 +60,7 @@ object RssParserByRule { ruleTitle, rulePubDate, ruleDescription, ruleImage, ruleLink )?.let { it.sort = sortName - it.origin = rssSource.sourceUrl + it.origin = sourceUrl articleList.add(it) } } diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt index edc9215c2..3bcfc00ab 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssArticlesViewModel.kt @@ -39,7 +39,7 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application } App.db.rssArticleDao().insert(*list.toTypedArray()) if (!rssSource.ruleNextPage.isNullOrEmpty()) { - App.db.rssArticleDao().clearOld(rssSource.sourceUrl, order) + App.db.rssArticleDao().clearOld(rssSource.sourceUrl, sortName, order) loadFinally.postValue(true) } else { withContext(Dispatchers.Main) {