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 c4ee3467d..0c6290965 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 @@ -1,10 +1,7 @@ package io.legado.app.data.dao import androidx.lifecycle.LiveData -import androidx.room.Dao -import androidx.room.Insert -import androidx.room.OnConflictStrategy -import androidx.room.Query +import androidx.room.* import io.legado.app.data.entities.RssArticle @Dao @@ -15,4 +12,7 @@ interface RssArticleDao { @Insert(onConflict = OnConflictStrategy.IGNORE) fun insert(vararg rssArticle: RssArticle) + + @Update + fun update(vararg rssArticle: RssArticle) } \ No newline at end of file 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 b24445785..a75e7ae07 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 @@ -4,6 +4,7 @@ import android.app.Application import androidx.lifecycle.MutableLiveData import io.legado.app.App import io.legado.app.base.BaseViewModel +import io.legado.app.data.entities.RssArticle import io.legado.app.data.entities.RssSource import io.legado.app.model.Rss import kotlinx.coroutines.Dispatchers.IO @@ -34,4 +35,11 @@ class RssArticlesViewModel(application: Application) : BaseViewModel(application } } + fun read(rssArticle: RssArticle) { + execute { + rssArticle.read = true + App.db.rssArtivleDao().update(rssArticle) + } + } + } \ No newline at end of file