Skip to content

Commit

Permalink
style: lint적용
Browse files Browse the repository at this point in the history
  • Loading branch information
Namyunsuk committed Aug 7, 2024
1 parent e6ec36a commit 76e52ae
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ class OfferingViewModel(
OfferingPagingSource(offeringRepository, search.value, selectedFilter.value)
},
).flow.cachedIn(viewModelScope).collectLatest { pagingData ->
_offerings.value = pagingData.map {
if (isSearchKeywordExist() && isTitleContainSearchKeyword(it)) {
return@map it.copy(title = highlightSearchKeyword(it.title, search.value!!))
_offerings.value =
pagingData.map {
if (isSearchKeywordExist() && isTitleContainSearchKeyword(it)) {
return@map it.copy(title = highlightSearchKeyword(it.title, search.value!!))
}
it.copy(title = removeAsterisks(it.title))
}
it.copy(title = removeAsterisks(it.title))
}
}
}
_searchEvent.setValue(search.value)
Expand All @@ -81,7 +82,10 @@ class OfferingViewModel(
return title.replace("*", "")
}

private fun highlightSearchKeyword(title: String, keyword: String): String {
private fun highlightSearchKeyword(
title: String,
keyword: String,
): String {
return title.replace(keyword, "*$keyword*")
}

Expand Down

0 comments on commit 76e52ae

Please sign in to comment.