mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-18 09:07:01 +05:30
Liked flag toggle should go both ways
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
e35a25b135
commit
c54b375c06
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ class LobstersViewModel @ViewModelInject constructor(
|
||||||
private fun getMorePostsInternal(firstLoad: Boolean) {
|
private fun getMorePostsInternal(firstLoad: Boolean) {
|
||||||
viewModelScope.launch(coroutineExceptionHandler) {
|
viewModelScope.launch(coroutineExceptionHandler) {
|
||||||
val newPosts = lobstersApi.getHottestPosts(apiPage)
|
val newPosts = lobstersApi.getHottestPosts(apiPage)
|
||||||
.map { it.apply { if (savedPostsDao.isLiked(shortId)) isLiked = true } }
|
.map { it.apply { isLiked = savedPostsDao.isLiked(shortId) } }
|
||||||
.toList()
|
.toList()
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
_posts.value = newPosts
|
_posts.value = newPosts
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue