From 63cfe439366bd4f5169874cc1760b26fe57e4bfd Mon Sep 17 00:00:00 2001 From: Jokwanhee Date: Wed, 28 Aug 2024 00:04:54 +0900 Subject: [PATCH] =?UTF-8?q?[fix/#133]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=ED=95=98=EA=B8=B0=20=EB=94=A5=EB=A7=81?= =?UTF-8?q?=ED=81=AC=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EA=B3=B5=EC=9C=A0?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dpm/presentation/util/KakaoUtils.kt | 4 +++- .../DetailReviewInteractionItems.kt | 24 ++++++++++++++----- .../detailpicture/DetailViewPagerLayer.kt | 3 +++ .../StadiumDetailPictureViewPager.kt | 3 +++ .../StadiumDetailReviewViewPager.kt | 1 + .../main/StadiumDetailPictureTopScreen.kt | 7 +++++- .../top/StadiumDetailPictureMainScreen.kt | 10 ++++++-- 7 files changed, 42 insertions(+), 10 deletions(-) diff --git a/presentation/src/main/java/com/dpm/presentation/util/KakaoUtils.kt b/presentation/src/main/java/com/dpm/presentation/util/KakaoUtils.kt index d31873de..464ef0a8 100644 --- a/presentation/src/main/java/com/dpm/presentation/util/KakaoUtils.kt +++ b/presentation/src/main/java/com/dpm/presentation/util/KakaoUtils.kt @@ -42,7 +42,9 @@ fun seatFeed( title = title, description = description, imageUrl = imageUrl, - link = Link() + link = Link( + androidExecutionParams = queryParams + ) ), buttons = listOf( Button( diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailReviewInteractionItems.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailReviewInteractionItems.kt index 95271b53..f37cbe2f 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailReviewInteractionItems.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailReviewInteractionItems.kt @@ -1,5 +1,6 @@ package com.dpm.presentation.viewfinder.compose.detailpicture +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -23,6 +24,7 @@ import com.dpm.designsystem.compose.ui.SpotTheme @Composable fun DetailReviewInteractionItems( + isScrap: Boolean, isLike: Boolean, likeCount: Long, modifier: Modifier = Modifier, @@ -63,12 +65,20 @@ fun DetailReviewInteractionItems( IconButton(onClick = { onClickScrap() }, modifier.size(24.dp)) { - Icon( - painter = painterResource(id = R.drawable.ic_scrap), - contentDescription = null, - tint = SpotTheme.colors.foregroundWhite, - modifier = Modifier.size(24.dp) - ) + if (isScrap) { + Image( + painter = painterResource(id = R.drawable.ic_scrap_active), + contentDescription = null, + modifier = Modifier.size(24.dp) + ) + } else { + Icon( + painter = painterResource(id = R.drawable.ic_scrap), + contentDescription = null, + tint = SpotTheme.colors.foregroundWhite, + modifier = Modifier.size(24.dp) + ) + } } Spacer(modifier = Modifier.height(20.dp)) IconButton(onClick = onClickShare, modifier.size(24.dp)) { @@ -86,6 +96,7 @@ fun DetailReviewInteractionItems( @Composable private fun DetailReviewInteractionItemsLikePreview() { DetailReviewInteractionItems( + isScrap = false, isLike = true, likeCount = 1, onClickLike = {}, @@ -98,6 +109,7 @@ private fun DetailReviewInteractionItemsLikePreview() { @Composable private fun DetailReviewInteractionItemsPreview() { DetailReviewInteractionItems( + isScrap = true, isLike = false, likeCount = 1, onClickLike = {}, diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailViewPagerLayer.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailViewPagerLayer.kt index 330843cf..855a0d8e 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailViewPagerLayer.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/DetailViewPagerLayer.kt @@ -19,6 +19,7 @@ import com.dpm.domain.entity.response.viewfinder.ResponseBlockReview @Composable fun DetailViewPagerLayer( context: Context, + isScrap: Boolean, isLike: Boolean, likeCount: Long, isFirstLike: Boolean, @@ -38,6 +39,7 @@ fun DetailViewPagerLayer( horizontalAlignment = Alignment.CenterHorizontally ) { StadiumDetailPictureViewPager( + isScrap = isScrap, isLike = isLike, context = context, pictures = pictures, @@ -75,6 +77,7 @@ private fun DetailViewPagerLayerPreview() { DetailViewPagerLayer( context = LocalContext.current, isDimmed = true, + isScrap = true, isLike = true, isFirstLike = true, likeCount = 1, diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailPictureViewPager.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailPictureViewPager.kt index 4729994e..16245210 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailPictureViewPager.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailPictureViewPager.kt @@ -50,6 +50,7 @@ import kotlinx.coroutines.launch fun StadiumDetailPictureViewPager( context: Context, isLike: Boolean, + isScrap: Boolean, isFirstLike: Boolean, likeCount: Long, verticalPagerState: PagerState, @@ -135,6 +136,7 @@ fun StadiumDetailPictureViewPager( contentAlignment = Alignment.CenterEnd ) { DetailReviewInteractionItems( + isScrap = isScrap, isLike = isLike, likeCount = likeCount, onClickLike = { @@ -189,6 +191,7 @@ private fun StadiumDetailPictureViewPagerPreview() { } StadiumDetailPictureViewPager( context = LocalContext.current, + isScrap = true, isLike = true, likeCount = 1, isFirstLike = true, diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailReviewViewPager.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailReviewViewPager.kt index 5b85794a..b28827ee 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailReviewViewPager.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/StadiumDetailReviewViewPager.kt @@ -85,6 +85,7 @@ fun StadiumDetailReviewViewPager( DetailViewPagerLayer( context = context, isDimmed = isDimmed, + isScrap = reviews[page].isScrap, isLike = reviews[page].isLike, isFirstLike = isFirstLike, likeCount = reviews[page].likesCount, diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/main/StadiumDetailPictureTopScreen.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/main/StadiumDetailPictureTopScreen.kt index 9b24e492..5ed4af13 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/main/StadiumDetailPictureTopScreen.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/main/StadiumDetailPictureTopScreen.kt @@ -76,7 +76,12 @@ fun StadiumDetailPictureTopScreen( isFirstLikeState = false stadiumDetailViewModel.updateTopReviewLike(id) }, - onClickScrap = onClickScrap, + onClickScrap = { id -> + onClickScrap(id) + if (!stadiumDetailViewModel.checkTopReviewScrap(id)) { + stadiumDetailViewModel.updateTopReviewScrap(id) + } + }, onClickShare = { imagePosition -> onClickShare() KakaoUtils().share( diff --git a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/top/StadiumDetailPictureMainScreen.kt b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/top/StadiumDetailPictureMainScreen.kt index 8310dff1..a52cb99e 100644 --- a/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/top/StadiumDetailPictureMainScreen.kt +++ b/presentation/src/main/java/com/dpm/presentation/viewfinder/compose/detailpicture/top/StadiumDetailPictureMainScreen.kt @@ -38,7 +38,7 @@ fun StadiumDetailPictureMainScreen( onClickScrap: (id: Long) -> Unit = {}, onClickShare: () -> Unit = {} ) { - when(uiState) { + when (uiState) { is StadiumDetailUiState.ReviewsData -> { val visited = remember { mutableStateListOf( @@ -100,7 +100,12 @@ fun StadiumDetailPictureMainScreen( isFirstLikeState = false stadiumDetailViewModel.updateLike(id) }, - onClickScrap = onClickScrap, + onClickScrap = { id -> + onClickScrap(id) + if (!stadiumDetailViewModel.checkScrap(id)) { + stadiumDetailViewModel.updateScrap(id) + } + }, onClickShare = { imagePosition -> onClickShare() KakaoUtils().share( @@ -121,6 +126,7 @@ fun StadiumDetailPictureMainScreen( } ) } + else -> Unit } }