Skip to content

Commit

Permalink
Refactor extractArticleHtmlContent in reader presenter
Browse files Browse the repository at this point in the history
Simplified the conditionals
  • Loading branch information
msasikanth committed Feb 7, 2024
1 parent 5ff4ad5 commit faa0681
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,12 @@ class ReaderPresenter(
}

private suspend fun extractArticleHtmlContent(postLink: String, content: String): String {
if (content.trim().isBlank()) return content

val transformedContent =
val articleContent =
withContext(dispatchersProvider.io) { Readability(postLink, content) }.parse().content
return if (!transformedContent.isNullOrBlank()) {
transformedContent
} else {
content
}

if (articleContent.isNullOrBlank()) return content

return articleContent
}

private fun articleShortcutClicked() {
Expand Down

0 comments on commit faa0681

Please sign in to comment.