Skip to content

Commit cc82fd1

Browse files
authored
WordPress.com News images don't show in the reader (#21713)
* Renamed featuredImage to featuredImageView to clarify its a view * Close existing response before proceeding with new request * Updated comment * Check for null body to avoid IllegalStateException
1 parent e344e16 commit cc82fd1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostDetailFragment.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,13 +930,13 @@ class ReaderPostDetailFragment : ViewPagerFragment(),
930930
state: ReaderPostDetailsUiState.ReaderPostFeaturedImageUiState?,
931931
binding: ReaderFragmentPostDetailBinding
932932
) {
933-
val featuredImage = binding.appbarWithCollapsingToolbarLayout.featuredImage
934-
featuredImage.setVisible(state != null)
933+
val featuredImageView = binding.appbarWithCollapsingToolbarLayout.featuredImage
934+
featuredImageView.setVisible(state != null)
935935
state?.let {
936-
featuredImage.layoutParams.height = it.height
936+
featuredImageView.layoutParams.height = it.height
937937
it.url?.let { url ->
938-
imageManager.load(featuredImage, PHOTO, url, CENTER_CROP)
939-
featuredImage.setOnClickListener {
938+
imageManager.load(featuredImageView, PHOTO, url, CENTER_CROP)
939+
featuredImageView.setOnClickListener {
940940
viewModel.onFeaturedImageClicked(blogId = state.blogId, featuredImageUrl = url)
941941
}
942942
}

libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/CustomRedirectInterceptor.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class CustomRedirectInterceptor : Interceptor {
1313
if (response.isRedirect) {
1414
val newRequest = getRedirectRequest(originalRequest, response)
1515
if (newRequest != null) {
16+
// Failing to close the existing response results in this error:
17+
// "IllegalStateException: cannot make a new request because the
18+
// previous response is still open: please call response.close()"
19+
response.body?.close()
1620
return chain.proceed(newRequest)
1721
}
1822
}

0 commit comments

Comments
 (0)