diff --git a/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt b/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt index 57ab067d..0b37b6bc 100644 --- a/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt +++ b/feature/src/main/java/com/terning/feature/dialog/detail/ScrapDialog.kt @@ -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 @@ -79,6 +80,7 @@ fun ScrapDialog( is ScrapDialogSideEffect.ShowToast -> { context.toast(sideEffect.message) } + is ScrapDialogSideEffect.DismissDialog -> { viewModel.initUiState() onDismissRequest() @@ -89,8 +91,7 @@ fun ScrapDialog( internshipAnnouncementId ) - is ScrapDialogSideEffect.ScrappedAnnouncement -> { - } + is ScrapDialogSideEffect.ScrappedAnnouncement -> onScrapAnnouncement() } } } @@ -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 = {