From 95310e1cac8eae62e1bb3fdc727f43a1291e0ad9 Mon Sep 17 00:00:00 2001 From: asl97 Date: Sun, 8 Dec 2024 01:04:03 +0800 Subject: [PATCH 1/3] [Hotfix] Show snippet of feed instead of "Found nothing to fetch" For feed if for some reason cache was cleared --- .../java/com/nononsenseapps/feeder/archmodel/Repository.kt | 1 + .../feeder/ui/compose/feedarticle/ArticleViewModel.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/archmodel/Repository.kt b/app/src/main/java/com/nononsenseapps/feeder/archmodel/Repository.kt index 14ff1ec75..4e5c78a65 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/archmodel/Repository.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/archmodel/Repository.kt @@ -881,6 +881,7 @@ data class Article( val link: String? = item?.link val feedDisplayTitle: String = item?.feedDisplayTitle ?: "" val title: String = item?.plainTitle ?: "" + val snippet: String = item?.plainSnippet ?: "" val enclosure: Enclosure = item?.enclosureLink?.let { link -> Enclosure( diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt index 80ea3200d..b10cfec44 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt @@ -206,8 +206,8 @@ class ArticleViewModel( } } else { Log.e(LOG_TAG, "No default file to parse") - textToDisplay.update { TextToDisplay.FAILED_MISSING_BODY } - LinearArticle(elements = emptyList()) + textToDisplay.update { TextToDisplay.CONTENT } + htmlLinearizer.linearize(article.snippet, article.feedUrl ?: "") } } From d36a8be0272230781be72d22a3ec52e408d4a710 Mon Sep 17 00:00:00 2001 From: asl97 Date: Wed, 11 Dec 2024 21:38:16 +0800 Subject: [PATCH 2/3] Add an user noticable notice for why the snippet is shown --- .../feeder/ui/compose/feedarticle/ArticleViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt index b10cfec44..29659367c 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt @@ -207,7 +207,7 @@ class ArticleViewModel( } else { Log.e(LOG_TAG, "No default file to parse") textToDisplay.update { TextToDisplay.CONTENT } - htmlLinearizer.linearize(article.snippet, article.feedUrl ?: "") + htmlLinearizer.linearize("Sorry, due to a coding oversight, the full offline version of this article has been permanently deleted, see feeder#443 for updates on this issue

" + article.snippet, article.feedUrl ?: "") } } From 0636ead9401ac7e960142dbd500bb60f87141d43 Mon Sep 17 00:00:00 2001 From: asl97 Date: Wed, 11 Dec 2024 22:42:30 +0800 Subject: [PATCH 3/3] Run ./gradlew ktlintformat --- .../feeder/ui/compose/feedarticle/ArticleViewModel.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt index 29659367c..9f32604c5 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleViewModel.kt @@ -207,7 +207,14 @@ class ArticleViewModel( } else { Log.e(LOG_TAG, "No default file to parse") textToDisplay.update { TextToDisplay.CONTENT } - htmlLinearizer.linearize("Sorry, due to a coding oversight, the full offline version of this article has been permanently deleted, see feeder#443 for updates on this issue

" + article.snippet, article.feedUrl ?: "") + htmlLinearizer.linearize( + "Sorry, due to a coding oversight, " + + "the full offline version of this article has been permanently deleted, " + + "see feeder#443 " + + "for updates on this issue

" + + article.snippet, + article.feedUrl ?: "", + ) } }