Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import com.alarmy.near.model.ReminderInterval
import com.alarmy.near.presentation.feature.friendprofileedittor.component.NearDatePicker
import com.alarmy.near.presentation.feature.friendprofileedittor.component.ReminderIntervalBottomSheet
import com.alarmy.near.presentation.feature.friendprofileedittor.dialog.EditorExitDialog
import com.alarmy.near.presentation.feature.friendprofileedittor.dialog.SaveConfirmDialog
import com.alarmy.near.presentation.feature.friendprofileedittor.uistate.FriendProfileEditorUIEvent
import com.alarmy.near.presentation.feature.friendprofileedittor.uistate.FriendProfileEditorUIState
import com.alarmy.near.presentation.ui.component.NearFrame
Expand All @@ -68,7 +67,6 @@ fun FriendProfileEditorRoute(
) {
val friendProfileEditorUIState = viewModel.uiState.collectAsStateWithLifecycle()
val warningDialogState = remember { mutableStateOf(false) }
val saveConfirmDialogState = remember { mutableStateOf(false) }
val context = LocalContext.current
BackHandler {
viewModel.onExit()
Expand Down Expand Up @@ -105,7 +103,6 @@ fun FriendProfileEditorRoute(
FriendProfileEditorScreen(
friendProfileEditorUIState = friendProfileEditorUIState.value,
dialogState = warningDialogState.value,
saveConfirmDialogState = saveConfirmDialogState.value,
onClickBackButton = viewModel::onExit,
onNameChanged = viewModel::onNameChanged,
onRelationChanged = viewModel::onRelationChanged,
Expand All @@ -119,7 +116,6 @@ fun FriendProfileEditorRoute(
onSubmit = viewModel::onSubmit,
onEditorExit = onClickBackButton,
onCloseDialog = { warningDialogState.value = false },
onSaveConfirmDialogStateChanged = { saveConfirmDialogState.value = it },
)
}

Expand All @@ -128,7 +124,6 @@ fun FriendProfileEditorRoute(
fun FriendProfileEditorScreen(
modifier: Modifier = Modifier,
dialogState: Boolean = false,
saveConfirmDialogState: Boolean = false,
friendProfileEditorUIState: FriendProfileEditorUIState,
onClickBackButton: () -> Unit = {},
onNameChanged: (String) -> Unit = {},
Expand All @@ -143,7 +138,6 @@ fun FriendProfileEditorScreen(
onSubmit: () -> Unit = {},
onEditorExit: () -> Unit = {},
onCloseDialog: () -> Unit = {},
onSaveConfirmDialogStateChanged: (Boolean) -> Unit = {},
) {
val showBottomSheet = remember { mutableStateOf(false) }
if (showBottomSheet.value) {
Expand All @@ -165,12 +159,6 @@ fun FriendProfileEditorScreen(
)
}

if (saveConfirmDialogState) {
SaveConfirmDialog(
onDismissRequest = { onSaveConfirmDialogStateChanged(false) },
onConfirm = onSubmit,
)
}
NearFrame(modifier = modifier) {
LazyColumn(modifier = Modifier.fillMaxSize()) {
item {
Expand All @@ -182,7 +170,7 @@ fun FriendProfileEditorScreen(
Text(
modifier =
Modifier.onNoRippleClick(onClick = {
onSaveConfirmDialogStateChanged(true)
onSubmit()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

onSubmit을 직접 호출하도록 변경한 것은 좋습니다. 하지만 이로 인해 FriendProfileEditorViewModel의 유효성 검사 로직에 있는 잠재적인 문제가 드러날 수 있습니다.

onSubmit 함수는 기념일 제목에 대해 isBlank()를 사용하여 유효성을 검사하지만, UI에 오류를 표시하는 error 상태는 onAnniversaryTitleChanged 함수에서 isEmpty()를 사용하여 설정됩니다. 이 불일치로 인해 사용자가 공백만 입력할 경우 UI에는 오류가 표시되지 않지만 저장은 조용히 실패하게 됩니다.

일관된 동작을 보장하고 사용자에게 명확한 피드백을 제공하기 위해, FriendProfileEditorViewModelonNameChangedonAnniversaryTitleChanged에서도 isBlank()를 사용하여 유효성을 검사하고 error 상태를 설정하는 것을 강력히 권장합니다. 이렇게 하면 사용자가 저장 버튼을 눌렀을 때 왜 저장이 안 되는지 명확히 알 수 있습니다.

}),
text = stringResource(R.string.friend_profile_editor_edit_complete_text),
style = NearTheme.typography.B1_16_BOLD,
Expand Down

This file was deleted.