Skip to content

Commit

Permalink
Update selectedHighlight on article observed
Browse files Browse the repository at this point in the history
  • Loading branch information
markocic committed Dec 17, 2024
1 parent b74bb40 commit 3ad0c57
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,14 @@ class ArticleDetailsViewModel @Inject constructor(
}

setState {
val joinedHighlights = article.highlights.joinOnContent()
val selectedHighlight = selectedHighlight?.let {
joinedHighlights.first { it.content == selectedHighlight.content }
}
copy(
article = article.mapAsArticleDetailsUi(),
highlights = article.highlights.joinOnContent(),
highlights = joinedHighlights,
selectedHighlight = selectedHighlight,
topZaps = article.eventZaps
.map { it.asEventZapUiModel() }
.sortedWith(EventZapUiModel.DefaultComparator),
Expand Down

0 comments on commit 3ad0c57

Please sign in to comment.