From 639eb8898df7d5ee28dac8916a3971391755b075 Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Thu, 30 Nov 2023 21:37:42 +0100 Subject: [PATCH] Fixed some cover images appearing twice in reader if full text --- .../feeder/ui/compose/feedarticle/ArticleScreen.kt | 1 + .../feeder/ui/compose/feedarticle/ReaderView.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt index f5ee69ca5..2e68480bc 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ArticleScreen.kt @@ -432,6 +432,7 @@ fun ArticleContent( }, image = viewState.image, imageFromBody = viewState.imageFromBody, + isFeedText = viewState.textToDisplay == TextToDisplay.DEFAULT, ) { // Can take a composition or two before viewstate is set to its actual values if (viewState.articleId > ID_UNSET) { diff --git a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ReaderView.kt b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ReaderView.kt index ee45f1306..5398da889 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ReaderView.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/ui/compose/feedarticle/ReaderView.kt @@ -89,6 +89,7 @@ fun ReaderView( authorDate: String?, image: String?, imageFromBody: Boolean, + isFeedText: Boolean, modifier: Modifier = Modifier, articleListState: LazyListState = rememberLazyListState(), articleBody: LazyListScope.() -> Unit, @@ -288,7 +289,8 @@ fun ReaderView( } } - if (!imageFromBody && image != null) { + // Don't show image for full text articles since it's typically inside the full article + if (isFeedText && !imageFromBody && image != null) { item { BoxWithConstraints( modifier = @@ -353,6 +355,7 @@ private fun ReaderPreview() { authorDate = "2018-01-02", image = "https://cowboyprogrammer.org/images/2017/10/gimp_image_mode_index.png", imageFromBody = false, + isFeedText = true, ) {} } }