-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
🛠️ Refactor suggestion | 🟠 Major
FavoriteResult 객체를 직접 전달하도록 개선이 필요합니다.
이전 리뷰에서도 지적되었던 부분인데요, favoriteResult.name을 사용하는 방식은 다음과 같은 문제가 있습니다:
enum.name은 "ADDED", "REMOVED", "FULL" 같은 원시 상수명을 반환하므로 사용자 친화적이지 않습니다- 다국어 지원이나 적절한 메시지 포맷팅이 어렵습니다
FavoriteToast 컴포넌트가 FavoriteResult 객체를 직접 받아서 내부에서 적절한 문자열 리소스로 변환하도록 리팩토링하는 것을 권장드립니다.
다음과 같이 수정하시면 좋을 것 같습니다:
is ShowFavoriteToast -> {
// dismiss current snackbar if exists
snackState.currentSnackbarData?.dismiss()
- snackState.showSnackbar(sideEffect.favoriteResult.name)
+ snackState.showSnackbar(sideEffect.favoriteResult.toString())
}그리고 Line 295의 FavoriteToast 호출 부분도 함께 수정이 필요합니다:
// FavoriteToast가 FavoriteResult를 받도록 시그니처 변경 필요
AppSnackbarHost(hostState = snackState) { snackbarData ->
// 실제 FavoriteResult 객체를 전달하는 방식으로 개선 필요
FavoriteToast(/* FavoriteResult 객체 전달 */)
}참고: 현재 Snackbar 시스템이 String만 전달할 수 있다면, custom SnackbarVisuals를 구현하여 FavoriteResult를 전달하는 방법도 고려해보세요.
🤖 Prompt for AI Agents
In
feat/time-capsule-detail/src/main/java/com/emotionstorage/time_capsule_detail/ui/TimeCapsuleDetailScreen.kt
around lines 134-138 (and also update the FavoriteToast invocation at ~line
295), stop passing favoriteResult.name to the snackbar and instead pass the
FavoriteResult object itself; change the flow so the side effect/snackbar
payload carries the FavoriteResult instance (or implement a custom
SnackbarVisuals that contains FavoriteResult), update AppSnackbarHost usage to
forward the FavoriteResult into FavoriteToast, and change FavoriteToast's
signature to accept FavoriteResult and resolve the user-facing string via string
resources inside FavoriteToast (not by using enum.name). Ensure fallback
handling if the snackbar system only supports String by implementing a custom
visuals wrapper and mapping to a localized message inside FavoriteToast.
Originally posted by @coderabbitai[bot] in #110 (comment)
Metadata
Metadata
Assignees
Labels
No labels