Skip to content

Commit

Permalink
feat: apply stringRes snackbar Message
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Jan 31, 2025
1 parent 01471fe commit d2911ee
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.currentBackStackEntryAsState
import com.chipichipi.dobedobe.feature.dashboard.R
import com.chipichipi.dobedobe.feature.dashboard.navigation.DashboardRoute
import com.chipichipi.dobedobe.feature.dashboard.navigation.dashboardScreen
import com.chipichipi.dobedobe.feature.goal.GoalSnackBarType
Expand Down Expand Up @@ -64,21 +66,19 @@ private fun GoalSnackBarEffect(
GoalSnackBarType.KEY,
GoalSnackBarType.IDLE,
)
val addGoalMessage =
stringResource(id = R.string.feature_dashboard_add_goal_snackbar_message)
val editGoalMessage =
stringResource(id = R.string.feature_dashboard_edit_goal_snackbar_message)
val removeGoalMessage =
stringResource(id = R.string.feature_dashboard_remove_goal_snackbar_message)

LaunchedEffect(snackBarState) {
when (snackBarState.value) {
GoalSnackBarType.IDLE -> {}
GoalSnackBarType.ADD -> {
onShowSnackbar("목표가 추가되었습니다", "확인")
}

GoalSnackBarType.EDIT -> {
onShowSnackbar("목표가 수정되었습니다", "확인")
}

GoalSnackBarType.REMOVE -> {
onShowSnackbar("목표가 삭제되었습니다", "확인")
}
GoalSnackBarType.ADD -> onShowSnackbar(addGoalMessage, null)
GoalSnackBarType.EDIT -> onShowSnackbar(editGoalMessage, null)
GoalSnackBarType.REMOVE -> onShowSnackbar(removeGoalMessage, null)
}
backStackEntry.removeSnackBarEvent()
}
Expand Down
3 changes: 3 additions & 0 deletions feature/dashboard/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<string name="feature_dashboard_edit_delete_image">이미지 삭제</string>
<string name="feature_dashboard_bubble_suffix">해낼 거야!</string>
<string name="feature_dashboard_goal_bottom_sheet_title">나의 목표</string>
<string name="feature_dashboard_add_goal_snackbar_message">목표가 추가되었습니다.</string>
<string name="feature_dashboard_remove_goal_snackbar_message">목표가 삭제되었습니다.</string>
<string name="feature_dashboard_edit_goal_snackbar_message">목표가 수정되었습니다.</string>
</resources>
4 changes: 3 additions & 1 deletion feature/dashboard/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
<string name="feature_dashboard_edit_delete_image">이미지 삭제</string>
<string name="feature_dashboard_bubble_suffix">해낼 거야!</string>
<string name="feature_dashboard_goal_bottom_sheet_title">나의 목표</string>

<string name="feature_dashboard_add_goal_snackbar_message">목표가 추가되었습니다.</string>
<string name="feature_dashboard_remove_goal_snackbar_message">목표가 삭제되었습니다.</string>
<string name="feature_dashboard_edit_goal_snackbar_message">목표가 수정되었습니다.</string>
</resources>
4 changes: 0 additions & 4 deletions feature/goal/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@
<string name="feature_goal_title_error_message_too_long">You can only write 20 characters including spaces</string>

<string name="feature_goal_navigate_back_icon_content_description">navigate back</string>

<string name="feature_goal_add_goal_snackbar_message">목표가 추가되었습니다.</string>
<string name="feature_goal_remove_goal_snackbar_message">목표가 삭제되었습니다.</string>
<string name="feature_goal_edit_goal_snackbar_message">목표가 수정되었습니다.</string>
</resources>
4 changes: 0 additions & 4 deletions feature/goal/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@

<string name="feature_goal_navigate_back_icon_content_description">뒤로 가기</string>

<string name="feature_goal_add_goal_snackbar_message">목표가 추가되었습니다.</string>
<string name="feature_goal_remove_goal_snackbar_message">목표가 삭제되었습니다.</string>
<string name="feature_goal_edit_goal_snackbar_message">목표가 수정되었습니다.</string>

</resources>

0 comments on commit d2911ee

Please sign in to comment.