From 082a7ef209c45dd6c4607c9fb0a02434ee60bc47 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 11 Sep 2024 18:07:43 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[FEAT/#239]=20=ED=99=94=EB=A9=B4=EC=97=90?= =?UTF-8?q?=20background=20color=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/intern/InternRoute.kt | 6 +++++- .../java/com/terning/feature/search/search/SearchRoute.kt | 3 +++ .../feature/search/searchprocess/SearchProcessRoute.kt | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index ef02c79ed..266fc55be 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -2,6 +2,7 @@ package com.terning.feature.intern import android.view.ViewGroup import android.webkit.WebView +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight @@ -27,6 +28,7 @@ import com.terning.core.designsystem.theme.CalRed import com.terning.core.designsystem.theme.Grey200 import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.extension.customShadow import com.terning.core.extension.toast import com.terning.core.state.UiState @@ -136,7 +138,9 @@ fun InternScreen( } Column( - modifier = modifier.fillMaxHeight(), + modifier = modifier + .fillMaxHeight() + .background(White), ) { Column( modifier = Modifier.weight(1f) diff --git a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt index 1088e226c..84454cd82 100644 --- a/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/search/SearchRoute.kt @@ -1,5 +1,6 @@ package com.terning.feature.search.search +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -22,6 +23,7 @@ import com.terning.core.designsystem.component.image.TerningImage import com.terning.core.designsystem.component.textfield.SearchTextField import com.terning.core.designsystem.theme.Black import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.extension.noRippleClickable import com.terning.core.state.UiState import com.terning.domain.entity.search.SearchPopularAnnouncement @@ -96,6 +98,7 @@ fun SearchScreen( Column( modifier = modifier .fillMaxSize() + .background(White) ) { TerningImage( painter = com.terning.core.R.drawable.ic_terning_logo_typo, diff --git a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt index 50809694c..09d4ff6b7 100644 --- a/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt +++ b/feature/src/main/java/com/terning/feature/search/searchprocess/SearchProcessRoute.kt @@ -1,6 +1,7 @@ package com.terning.feature.search.searchprocess import androidx.compose.foundation.Image +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -47,6 +48,7 @@ import com.terning.core.designsystem.theme.Grey500 import com.terning.core.designsystem.theme.TerningMain import com.terning.core.designsystem.theme.TerningPointTheme import com.terning.core.designsystem.theme.TerningTheme +import com.terning.core.designsystem.theme.White import com.terning.core.extension.addFocusCleaner import com.terning.core.extension.noRippleClickable import com.terning.core.extension.toast @@ -138,6 +140,7 @@ fun SearchProcessScreen( Column( modifier = modifier .fillMaxSize() + .background(White) .addFocusCleaner(focusManager), ) { BackButtonTopAppBar( From 2fbb25d7e38dcc35f602bda9e3b72eecea4e76e3 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 11 Sep 2024 18:18:49 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[FEAT/#239]=20=EA=B3=B5=EA=B3=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EB=B7=B0=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/intern/InternRoute.kt | 6 ++++-- .../terning/feature/intern/navigation/InternNavigation.kt | 5 ----- .../src/main/java/com/terning/feature/main/MainScreen.kt | 1 - 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 266fc55be..205a47b65 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -6,7 +6,9 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.material3.Text @@ -47,7 +49,6 @@ import java.text.DecimalFormat @Composable fun InternRoute( announcementId: Long = 0, - modifier: Modifier, viewModel: InternViewModel = hiltViewModel(), navController: NavHostController, ) { @@ -77,7 +78,6 @@ fun InternRoute( InternScreen( announcementId = announcementId, internUiState = internState, - modifier = modifier, internInfo = (internState.loadState as UiState.Success).data, navController = navController, onDismissCancelDialog = { @@ -139,6 +139,8 @@ fun InternScreen( Column( modifier = modifier + .statusBarsPadding() + .navigationBarsPadding() .fillMaxHeight() .background(White), ) { diff --git a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt index 7af39f4c0..7bc5c14c3 100644 --- a/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt +++ b/feature/src/main/java/com/terning/feature/intern/navigation/InternNavigation.kt @@ -2,9 +2,6 @@ package com.terning.feature.intern.navigation import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.padding -import androidx.compose.ui.Modifier import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -27,7 +24,6 @@ fun NavController.navigateIntern( fun NavGraphBuilder.internNavGraph( navHostController: NavHostController, - paddingValues: PaddingValues, ) { composable( exitTransition = { @@ -46,7 +42,6 @@ fun NavGraphBuilder.internNavGraph( val args = it.toRoute() InternRoute( announcementId = args.announcementId, - modifier = Modifier.padding(paddingValues), navController = navHostController ) } diff --git a/feature/src/main/java/com/terning/feature/main/MainScreen.kt b/feature/src/main/java/com/terning/feature/main/MainScreen.kt index ce270cd8e..585768eed 100644 --- a/feature/src/main/java/com/terning/feature/main/MainScreen.kt +++ b/feature/src/main/java/com/terning/feature/main/MainScreen.kt @@ -168,7 +168,6 @@ fun MainScreen( navHostController = navigator.navController ) internNavGraph( - paddingValues = paddingValues, navHostController = navigator.navController ) myPageNavGraph( From 5b3a6dfc24794ee2e196119ad5e9b202c6b241cb Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 11 Sep 2024 18:29:16 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[FIX/#239]=20=EA=B3=B5=EA=B3=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EB=B7=B0=20Padding=20=EA=B0=92=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/terning/feature/intern/InternRoute.kt | 4 ++-- .../com/terning/feature/intern/component/InternInfoRow.kt | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 205a47b65..4c458c4d8 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -206,7 +206,7 @@ fun InternScreen( } } - Spacer(modifier = Modifier.padding(top = 16.dp)) + Spacer(modifier = Modifier.padding(top = 13.dp)) InternPageTitle( modifier = Modifier, @@ -225,7 +225,7 @@ fun InternScreen( } } - Spacer(modifier = Modifier.padding(top = 16.dp)) + Spacer(modifier = Modifier.padding(top = 13.dp)) InternPageTitle( modifier = Modifier, diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt b/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt index 756b4c097..7b67986be 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternInfoRow.kt @@ -2,9 +2,11 @@ package com.terning.feature.intern.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.padding import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.terning.core.designsystem.theme.Grey400 import com.terning.core.designsystem.theme.Grey500 @@ -13,6 +15,7 @@ import com.terning.core.designsystem.theme.TerningTheme @Composable fun InternInfoRow(title: String, value: String) { Row( + modifier = Modifier.padding(bottom = 3.dp), horizontalArrangement = Arrangement.spacedBy(23.dp, Alignment.Start), verticalAlignment = Alignment.Top, ) { From 34f3d7a3ec64fbd89f9e22f76d1ec6959c784791 Mon Sep 17 00:00:00 2001 From: arinming Date: Wed, 11 Sep 2024 20:10:12 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[FEAT/#239]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=EC=B7=A8=EC=86=8C=20=EB=8B=A4=EC=9D=B4=EC=96=BC=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=20=EB=9D=84=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 44 ++++++++++--------- .../terning/feature/intern/InternViewModel.kt | 21 +++++---- .../intern/component/InternBottomBar.kt | 4 +- .../feature/intern/model/InternUiState.kt | 2 +- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index 4c458c4d8..e9bc8edf3 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -90,7 +90,9 @@ fun InternRoute( onClickScrapButton = { with(viewModel) { updateInternshipModel(it) - updateInternDialogVisibility(true) + if (internState.isScrappedState) + updateScrapCancelDialogVisibility(true) + else updateInternDialogVisibility(true) } } ) @@ -255,37 +257,37 @@ fun InternScreen( InternBottomBar( modifier = Modifier, internInfo = internInfo, + internUiState = internUiState, onScrapClick = { - if (!internUiState.isScrappedState) + if (!internUiState.isScrappedState) { onClickScrapButton(internInfo) - else onClickCancelButton(internInfo) + } else { + onClickCancelButton(internInfo) + } }, ) - - if (internUiState.scrapDialogVisibility) { + if (internUiState.scrapCancelDialogVisibility && internUiState.isScrappedState) { ScrapCancelDialog( internshipAnnouncementId = announcementId, onDismissRequest = onDismissCancelDialog ) } - if (internUiState.internDialogVisibility) { - internUiState.internshipModel?.let { - ScrapDialog( - title = internUiState.internshipModel.title, - scrapColor = CalRed, - deadline = internUiState.internshipModel.deadline, - startYearMonth = internUiState.internshipModel.startDate, - workingPeriod = internUiState.internshipModel.workingPeriod, - internshipAnnouncementId = announcementId, - companyImage = internUiState.internshipModel.companyImage, - isScrapped = false, - onDismissRequest = onDismissScrapDialog, - onClickChangeColor = { }, - onClickNavigateButton = { } - ) - } + if (internUiState.internDialogVisibility && !internUiState.isScrappedState) { + ScrapDialog( + title = internInfo.title, + scrapColor = CalRed, + deadline = internInfo.deadline, + startYearMonth = internInfo.startDate, + workingPeriod = internInfo.workingPeriod, + internshipAnnouncementId = announcementId, + companyImage = internInfo.companyImage, + isScrapped = false, + onDismissRequest = onDismissScrapDialog, + onClickChangeColor = { }, + onClickNavigateButton = { } + ) } } } \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index 03c8b5b60..b7b5d07b8 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -3,7 +3,6 @@ package com.terning.feature.intern import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.terning.core.state.UiState -import com.terning.domain.entity.calendar.CalendarScrapDetail import com.terning.domain.entity.intern.InternInfo import com.terning.domain.repository.InternRepository import com.terning.feature.R @@ -33,7 +32,10 @@ class InternViewModel @Inject constructor( internRepository.getInternInfo(id) .onSuccess { internInfoModel -> _internUiState.update { currentState -> - currentState.copy(loadState = UiState.Success(internInfoModel)) + currentState.copy( + loadState = UiState.Success(internInfoModel), + isScrappedState = internInfoModel.scrapId != null, + ) } } .onFailure { @@ -42,26 +44,27 @@ class InternViewModel @Inject constructor( } } - fun updateInternshipModel(scrapDetailModel: InternInfo?) { + fun updateScrapCancelDialogVisibility(visibility: Boolean) { _internUiState.update { currentState -> currentState.copy( - internshipModel = scrapDetailModel + scrapCancelDialogVisibility = visibility, + isScrappedState = visibility ) } } - fun updateScrapCancelDialogVisibility(visibility: Boolean) { + fun updateInternDialogVisibility(visibility: Boolean) { _internUiState.update { currentState -> currentState.copy( - scrapDialogVisibility = visibility + internDialogVisibility = visibility ) } } - fun updateInternDialogVisibility(visibility: Boolean) { + fun updateInternshipModel(scrapDetailModel: InternInfo?) { _internUiState.update { currentState -> currentState.copy( - internDialogVisibility = visibility + internshipModel = scrapDetailModel ) } } @@ -71,4 +74,4 @@ class InternViewModel @Inject constructor( it.copy(showWeb = show) } } -} \ No newline at end of file +} diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index 46e7dc7c0..cf0ca7b8f 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -27,11 +27,13 @@ import com.terning.core.extension.noRippleClickable import com.terning.domain.entity.intern.InternInfo import com.terning.feature.R import com.terning.feature.intern.InternViewModel +import com.terning.feature.intern.model.InternUiState @Composable fun InternBottomBar( modifier: Modifier, internInfo: InternInfo, + internUiState: InternUiState, onScrapClick: (InternInfo) -> Unit, viewModel: InternViewModel = hiltViewModel(), ) { @@ -64,7 +66,7 @@ fun InternBottomBar( Icon( painter = painterResource( id = - if (internInfo.scrapId != null) R.drawable.ic_scrap_true_24 + if (internUiState.isScrappedState) R.drawable.ic_scrap_true_24 else R.drawable.ic_scrap_false_24, ), contentDescription = null, diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt index adc01874f..3906b2e4b 100644 --- a/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt +++ b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt @@ -9,7 +9,7 @@ data class InternUiState( val loadState: UiState = UiState.Loading, val isColorChange: Boolean = false, val selectedColor: Color = CalRed, - val scrapDialogVisibility: Boolean = false, + val scrapCancelDialogVisibility: Boolean = false, val internDialogVisibility: Boolean = false, val isScrappedState: Boolean = false, val showWeb: Boolean = false, From 6e172275cb4744e62a167e3c7a277abccfd82b98 Mon Sep 17 00:00:00 2001 From: arinming Date: Thu, 12 Sep 2024 14:59:14 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[FEAT/#239]=20=EC=8A=A4=ED=81=AC=EB=9E=A9?= =?UTF-8?q?=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 13 ++++++++++--- .../terning/feature/intern/InternViewModel.kt | 1 - .../intern/component/InternBottomBar.kt | 18 ++++++++---------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index e9bc8edf3..c7b14af24 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -81,15 +81,22 @@ fun InternRoute( internInfo = (internState.loadState as UiState.Success).data, navController = navController, onDismissCancelDialog = { - viewModel.updateScrapCancelDialogVisibility(false) + with(viewModel) { + updateScrapCancelDialogVisibility(false) + getInternInfo(announcementId) + } + }, + onDismissScrapDialog = { + with(viewModel) { + updateInternDialogVisibility(false) + getInternInfo(announcementId) + } }, - onDismissScrapDialog = { viewModel.updateInternDialogVisibility(false) }, onClickCancelButton = { viewModel.updateScrapCancelDialogVisibility(true) }, onClickScrapButton = { with(viewModel) { - updateInternshipModel(it) if (internState.isScrappedState) updateScrapCancelDialogVisibility(true) else updateInternDialogVisibility(true) diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index b7b5d07b8..9eb0546e4 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -48,7 +48,6 @@ class InternViewModel @Inject constructor( _internUiState.update { currentState -> currentState.copy( scrapCancelDialogVisibility = visibility, - isScrappedState = visibility ) } } diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index cf0ca7b8f..7e7922f14 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -37,7 +37,6 @@ fun InternBottomBar( onScrapClick: (InternInfo) -> Unit, viewModel: InternViewModel = hiltViewModel(), ) { - Row( modifier = modifier .fillMaxWidth() @@ -65,20 +64,19 @@ fun InternBottomBar( ) { Icon( painter = painterResource( - id = - if (internUiState.isScrappedState) R.drawable.ic_scrap_true_24 - else R.drawable.ic_scrap_false_24, + id = if (internUiState.isScrappedState) { + R.drawable.ic_scrap_true_24 + } else { + R.drawable.ic_scrap_false_24 + } ), contentDescription = null, modifier = modifier - .padding( - bottom = 6.dp - ) + .padding(bottom = 6.dp) .noRippleClickable { onScrapClick(internInfo) }, - tint = if (internInfo.scrapId != null) TerningMain - else Grey350 + tint = if (internInfo.scrapId != null) TerningMain else Grey350 ) Text( text = stringResource( @@ -101,4 +99,4 @@ fun InternBottomBar( } } } -} \ No newline at end of file +} From 404568d62288c63d2c74157ebc8dc658c4dc18ab Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 14 Sep 2024 23:20:35 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[FIX/#239]=20=EA=B3=B5=EA=B3=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B5=AC=EC=A1=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/data/dto/response/InternResponseDto.kt | 10 ++++++---- .../terning/data/mapper/intern/InternInfoMapper.kt | 5 +++-- .../com/terning/domain/entity/intern/InternInfo.kt | 5 +++-- .../java/com/terning/feature/intern/InternRoute.kt | 7 +++---- .../com/terning/feature/intern/InternViewModel.kt | 14 +++++++------- .../feature/intern/component/InternBottomBar.kt | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/data/src/main/java/com/terning/data/dto/response/InternResponseDto.kt b/data/src/main/java/com/terning/data/dto/response/InternResponseDto.kt index 542c29130..3be4e1979 100644 --- a/data/src/main/java/com/terning/data/dto/response/InternResponseDto.kt +++ b/data/src/main/java/com/terning/data/dto/response/InternResponseDto.kt @@ -13,8 +13,8 @@ data class InternResponseDto( val deadline: String, @SerialName("workingPeriod") val workingPeriod: String, - @SerialName("startDate") - val startDate: String, + @SerialName("startYearMonth") + val startYearMonth: String, @SerialName("scrapCount") val scrapCount: Int, @SerialName("viewCount") @@ -33,6 +33,8 @@ data class InternResponseDto( val detail: String, @SerialName("url") val url: String, - @SerialName("scrapId") - val scrapId: Long? = null, + @SerialName("isScrapped") + val isScrapped: Boolean, + @SerialName("color") + val color: String? = null, ) \ No newline at end of file diff --git a/data/src/main/java/com/terning/data/mapper/intern/InternInfoMapper.kt b/data/src/main/java/com/terning/data/mapper/intern/InternInfoMapper.kt index 7e3e8c1e0..9084268eb 100644 --- a/data/src/main/java/com/terning/data/mapper/intern/InternInfoMapper.kt +++ b/data/src/main/java/com/terning/data/mapper/intern/InternInfoMapper.kt @@ -9,7 +9,7 @@ fun InternResponseDto.toInternInfo(): InternInfo = title = title, deadline = deadline, workingPeriod = workingPeriod, - startDate = startDate, + startYearMonth = startYearMonth, scrapCount = scrapCount, viewCount = viewCount, company = company, @@ -19,5 +19,6 @@ fun InternResponseDto.toInternInfo(): InternInfo = jobType = jobType, detail = detail, url = url, - scrapId = scrapId + isScrapped = isScrapped, + color = color, ) \ No newline at end of file diff --git a/domain/src/main/java/com/terning/domain/entity/intern/InternInfo.kt b/domain/src/main/java/com/terning/domain/entity/intern/InternInfo.kt index 77e70f12c..382db6d52 100644 --- a/domain/src/main/java/com/terning/domain/entity/intern/InternInfo.kt +++ b/domain/src/main/java/com/terning/domain/entity/intern/InternInfo.kt @@ -5,7 +5,7 @@ data class InternInfo( val title: String, val deadline: String, val workingPeriod: String, - val startDate: String, + val startYearMonth: String, val scrapCount: Int, val viewCount: Int, val company: String, @@ -15,5 +15,6 @@ data class InternInfo( val jobType: String, val detail: String, val url: String, - val scrapId: Long? = null, + val isScrapped: Boolean, + val color: String? = null, ) \ No newline at end of file diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index c7b14af24..a1f60ab7b 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -52,10 +52,9 @@ fun InternRoute( viewModel: InternViewModel = hiltViewModel(), navController: NavHostController, ) { - val internState by viewModel.internUiState.collectAsStateWithLifecycle() - val context = LocalContext.current val lifecycleOwner = LocalLifecycleOwner.current + val internState by viewModel.internUiState.collectAsStateWithLifecycle(lifecycleOwner) LaunchedEffect(key1 = true) { viewModel.getInternInfo(announcementId) @@ -124,7 +123,7 @@ fun InternScreen( val internInfoList = listOf( stringResource(id = R.string.intern_info_d_day) to internInfo.deadline, stringResource(id = R.string.intern_info_working) to internInfo.workingPeriod, - stringResource(id = R.string.intern_info_start_date) to internInfo.startDate, + stringResource(id = R.string.intern_info_start_date) to internInfo.startYearMonth, ) val qualificationList = listOf( @@ -286,7 +285,7 @@ fun InternScreen( title = internInfo.title, scrapColor = CalRed, deadline = internInfo.deadline, - startYearMonth = internInfo.startDate, + startYearMonth = internInfo.startYearMonth, workingPeriod = internInfo.workingPeriod, internshipAnnouncementId = announcementId, companyImage = internInfo.companyImage, diff --git a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt index 9eb0546e4..e1f955247 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternViewModel.kt @@ -31,14 +31,14 @@ class InternViewModel @Inject constructor( viewModelScope.launch { internRepository.getInternInfo(id) .onSuccess { internInfoModel -> - _internUiState.update { currentState -> - currentState.copy( - loadState = UiState.Success(internInfoModel), - isScrappedState = internInfoModel.scrapId != null, - ) - } + _internUiState.value = _internUiState.value.copy( + loadState = UiState.Success(internInfoModel) + ) } - .onFailure { + .onFailure { exception: Throwable -> + _internUiState.value = _internUiState.value.copy( + loadState = UiState.Failure(exception.toString()) + ) _sideEffect.emit(InternViewSideEffect.Toast(R.string.server_failure)) } } diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index 7e7922f14..08cae178a 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -76,7 +76,7 @@ fun InternBottomBar( .noRippleClickable { onScrapClick(internInfo) }, - tint = if (internInfo.scrapId != null) TerningMain else Grey350 + tint = if (internInfo.isScrapped) TerningMain else Grey350 ) Text( text = stringResource( From e1ef6bd846634c649dda12ec72087bb5b104e8b4 Mon Sep 17 00:00:00 2001 From: arinming Date: Sat, 14 Sep 2024 23:26:39 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[FIX/#239]=20=EA=B3=B5=EA=B3=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=8B=A4=EC=9D=B4?= =?UTF-8?q?=EC=96=BC=EB=A1=9C=EA=B7=B8=20=EB=A1=9C=EC=A7=81=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/terning/feature/intern/InternRoute.kt | 19 +++++++------------ .../intern/component/InternBottomBar.kt | 3 +-- .../feature/intern/model/InternUiState.kt | 1 - 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index a1f60ab7b..d6c9270b3 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -95,11 +95,7 @@ fun InternRoute( viewModel.updateScrapCancelDialogVisibility(true) }, onClickScrapButton = { - with(viewModel) { - if (internState.isScrappedState) - updateScrapCancelDialogVisibility(true) - else updateInternDialogVisibility(true) - } + viewModel.updateInternDialogVisibility(true) } ) } @@ -263,24 +259,23 @@ fun InternScreen( InternBottomBar( modifier = Modifier, internInfo = internInfo, - internUiState = internUiState, onScrapClick = { - if (!internUiState.isScrappedState) { - onClickScrapButton(internInfo) - } else { + if (internInfo.isScrapped) { onClickCancelButton(internInfo) + } else { + onClickScrapButton(internInfo) } }, ) - if (internUiState.scrapCancelDialogVisibility && internUiState.isScrappedState) { + if (internUiState.scrapCancelDialogVisibility) { ScrapCancelDialog( internshipAnnouncementId = announcementId, onDismissRequest = onDismissCancelDialog ) } - if (internUiState.internDialogVisibility && !internUiState.isScrappedState) { + if (internUiState.internDialogVisibility) { ScrapDialog( title = internInfo.title, scrapColor = CalRed, @@ -289,7 +284,7 @@ fun InternScreen( workingPeriod = internInfo.workingPeriod, internshipAnnouncementId = announcementId, companyImage = internInfo.companyImage, - isScrapped = false, + isScrapped = internInfo.isScrapped, onDismissRequest = onDismissScrapDialog, onClickChangeColor = { }, onClickNavigateButton = { } diff --git a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt index 08cae178a..bf5b2f1bf 100644 --- a/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt +++ b/feature/src/main/java/com/terning/feature/intern/component/InternBottomBar.kt @@ -33,7 +33,6 @@ import com.terning.feature.intern.model.InternUiState fun InternBottomBar( modifier: Modifier, internInfo: InternInfo, - internUiState: InternUiState, onScrapClick: (InternInfo) -> Unit, viewModel: InternViewModel = hiltViewModel(), ) { @@ -64,7 +63,7 @@ fun InternBottomBar( ) { Icon( painter = painterResource( - id = if (internUiState.isScrappedState) { + id = if (internInfo.isScrapped) { R.drawable.ic_scrap_true_24 } else { R.drawable.ic_scrap_false_24 diff --git a/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt index 3906b2e4b..0adb2c489 100644 --- a/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt +++ b/feature/src/main/java/com/terning/feature/intern/model/InternUiState.kt @@ -13,6 +13,5 @@ data class InternUiState( val internDialogVisibility: Boolean = false, val isScrappedState: Boolean = false, val showWeb: Boolean = false, - val scrapId: Long? = null, val internshipModel: InternInfo? = null, ) \ No newline at end of file From 180f9f3a7ba5fe0a999a60ea62f6238e9dc46953 Mon Sep 17 00:00:00 2001 From: arinming Date: Mon, 16 Sep 2024 03:10:34 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[FIX/#239]=20=EC=9B=B9=EB=B7=B0=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/terning/feature/intern/InternRoute.kt | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt index d6c9270b3..5dec1e4fc 100644 --- a/feature/src/main/java/com/terning/feature/intern/InternRoute.kt +++ b/feature/src/main/java/com/terning/feature/intern/InternRoute.kt @@ -1,7 +1,6 @@ package com.terning.feature.intern -import android.view.ViewGroup -import android.webkit.WebView +import androidx.browser.customtabs.CustomTabsIntent import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -19,7 +18,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.compose.ui.viewinterop.AndroidView +import androidx.core.net.toUri import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle @@ -114,6 +113,8 @@ fun InternScreen( onClickCancelButton: (InternInfo) -> Unit, onClickScrapButton: (InternInfo) -> Unit, ) { + val context = LocalContext.current + val decimal = DecimalFormat("#,###") val internInfoList = listOf( @@ -127,18 +128,10 @@ fun InternScreen( stringResource(id = R.string.intern_info_work) to internInfo.jobType, ) - if (internUiState.showWeb) { - AndroidView( - factory = { - WebView(it).apply { - layoutParams = ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT, - ) - loadUrl(internInfo.url) - } - }, - ) + LaunchedEffect(internUiState.showWeb) { + if (internUiState.showWeb) { + CustomTabsIntent.Builder().build().launchUrl(context, internInfo.url.toUri()) + } } Column(