diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f8c2b713..94fdc744 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -22,7 +22,7 @@ android { minSdk = 24 targetSdk = 35 versionCode = 24 - versionName = "2.1-beta02" + versionName = "2.1-beta03" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/com/skyd/anivu/model/repository/ArticleRepository.kt b/app/src/main/java/com/skyd/anivu/model/repository/ArticleRepository.kt index ea411246..4f8cc597 100644 --- a/app/src/main/java/com/skyd/anivu/model/repository/ArticleRepository.kt +++ b/app/src/main/java/com/skyd/anivu/model/repository/ArticleRepository.kt @@ -13,6 +13,7 @@ import com.skyd.anivu.model.bean.article.ArticleBean import com.skyd.anivu.model.bean.article.ArticleWithFeed import com.skyd.anivu.model.db.dao.ArticleDao import com.skyd.anivu.model.db.dao.FeedDao +import com.skyd.anivu.ui.component.showToast import kotlinx.coroutines.Deferred import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async @@ -96,12 +97,17 @@ class ArticleRepository @Inject constructor( feedUrls.forEach { feedUrl -> requests += async { val articleBeanListAsync = async { - rssHelper.queryRssXml( - feed = feedDao.getFeed(feedUrl), - latestLink = articleDao.queryLatestByFeedUrl(feedUrl)?.link, - )?.also { feedWithArticle -> - feedDao.updateFeed(feedWithArticle.feed) - }?.articles + runCatching { + rssHelper.queryRssXml( + feed = feedDao.getFeed(feedUrl), + latestLink = articleDao.queryLatestByFeedUrl(feedUrl)?.link, + )?.also { feedWithArticle -> + feedDao.updateFeed(feedWithArticle.feed) + }?.articles + }.onFailure { e -> + e.printStackTrace() + (feedUrl + "\n" + e.message).showToast() + }.getOrNull() } val articleBeanList = articleBeanListAsync.await() ?: return@async