Skip to content

Commit

Permalink
[FEAT/#231] 스크랩시 호출 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
boiledEgg-s committed Sep 9, 2024
1 parent 07a40ec commit 8bd69a7
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ fun ScrapDialog(
internshipAnnouncementId: Long,
companyImage: String,
isScrapped: Boolean,
onDismissRequest: () -> Unit,
onClickChangeColor: () -> Unit,
onClickNavigateButton: (Long) -> Unit,
onDismissRequest: () -> Unit = {},
onScrapAnnouncement: () -> Unit = {},
onClickChangeColor: () -> Unit = {},
onClickNavigateButton: (Long) -> Unit = {},
viewModel: ScrapDialogViewModel = hiltViewModel()
) {
val context = LocalContext.current
Expand All @@ -79,6 +80,7 @@ fun ScrapDialog(
is ScrapDialogSideEffect.ShowToast -> {
context.toast(sideEffect.message)
}

is ScrapDialogSideEffect.DismissDialog -> {
viewModel.initUiState()
onDismissRequest()
Expand All @@ -89,8 +91,7 @@ fun ScrapDialog(
internshipAnnouncementId
)

is ScrapDialogSideEffect.ScrappedAnnouncement -> {
}
is ScrapDialogSideEffect.ScrappedAnnouncement -> onScrapAnnouncement()
}
}
}
Expand All @@ -115,8 +116,11 @@ fun ScrapDialog(
isColorChangedOnce = uiState.isColorChangedOnce,
onClickColorButton = viewModel::changeSelectedColor,
onClickColorChangeButton = {
if(uiState.isColorChanged)
viewModel.patchScrap(scrapId = internshipAnnouncementId, color = uiState.selectedColorType)
if (uiState.isColorChanged)
viewModel.patchScrap(
scrapId = internshipAnnouncementId,
color = uiState.selectedColorType
)
},
onClickNavigateButton = viewModel::navigateToDetail,
onClickScrapButton = {
Expand Down

0 comments on commit 8bd69a7

Please sign in to comment.