Conversation
Jetpack Compose 마이그레이션의 일환으로 더 이상 사용되지 않는 `ScheduleAdapter`와 `ScheduleItemViewHolder`를 삭제했습니다.
- **`ScheduleAdapter.kt` 삭제:** `ScheduleEventUiModel` 리스트를 처리하던 `ListAdapter` 구현체를 제거했습니다.
- **`ScheduleItemViewHolder.kt` 삭제:**
- 일정의 상태(`COMPLETED`, `ONGOING`, `UPCOMING`)에 따라 동적으로 스타일과 텍스트를 설정하던 기존 `View` 시스템 로직을 제거했습니다.
- 배경 리소스, 텍스트 색상 분기 처리 및 하단 여백 계산 로직 등을 모두 삭제했습니다.
`ScheduleUiState`를 데이터 클래스로 전환하고 내부 상태를 `Content` 인터페이스로 래핑하여 UI 상태 관리의 일관성을 높였습니다.
- **`ScheduleUiState.kt` 수정:**
- 기존 `sealed interface` 구조에서 `Content`를 포함하는 `data class` 구조로 변경했습니다.
- `Refreshing` 상태를 제거하고 `Content` 하위의 `Success`, `Error`, `InitialLoading`으로 상태를 정규화했습니다.
- **`ScheduleViewModel.kt` 수정:**
- 변경된 `ScheduleUiState` 구조에 맞춰 초기값 설정 및 상태 업데이트 로직을 수정했습니다.
- `loadSchedules`, `updateEventsUiState` 등 주요 메서드에서 `content` 프로퍼티를 통해 상태에 접근하도록 변경했습니다.
- 이벤트 로드 여부 확인 로직(`isEventLoaded`)을 새로운 데이터 구조에 맞게 최적화했습니다.
- **`ScheduleScreen.kt` 및 `ScheduleTabPage.kt` 수정:**
- UI 레이어에서 `scheduleUiState.content`를 기준으로 상태 분기(`when`)를 처리하도록 변경했습니다.
- `ScheduleTabPage`의 파라미터 타입을 `ScheduleUiState.Content.Success`로 구체화하여 안정성을 높였습니다.
- `HorizontalPager`에서 잘못된 인덱스 접근 시 별도의 에러 UI 대신 `return@HorizontalPager`를 사용하도록 방어 코드를 수정했습니다.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ScheduleViewModel의 상태 구조 변경(Content 래퍼 및 내부 상태 계층 도입)에 맞춰 테스트 코드를 수정했습니다.
- **`ScheduleViewModelTest.kt` 수정:**
- `scheduleUiState`의 실제 데이터에 접근하기 위해 `.value.content`를 참조하도록 변경했습니다.
- 상태 타입 체크 및 캐스팅 로직을 `ScheduleUiState.Content.Success` 및 `ScheduleEventsUiState.Content.Success`로 업데이트했습니다.
- `eventsUiStateByPosition` 참조 시 널 안정성 및 계층 구조(`?.content`)를 반영하여 단언(Assertion) 로직을 수정했습니다.
oungsi2000
left a comment
There was a problem hiding this comment.
고생하셨습니다 제이 ~~
몇 가지 코멘트만 남겨드렸으니 확인부탁드려요 !
| sealed interface Content { | ||
| data object InitialLoading : Content | ||
|
|
||
| data class Refreshing( | ||
| val lastSuccessState: Success, | ||
| ) : ScheduleUiState | ||
| data class Success( | ||
| val dates: List<ScheduleDateUiModel>, | ||
| val currentDatePosition: Int, | ||
| val eventsUiStateByPosition: Map<Int, ScheduleEventsUiState> = emptyMap(), |
There was a problem hiding this comment.
Content를 ScheduleUiState에 중첩하신 이유가 있나요?
There was a problem hiding this comment.
새로고침을 할 때 새로고침 시간동안 기존 뷰를 유지하려면 기존 refreshing 객체는 이전 상태를 가지고 있어야 했습니다.
하지만 새로 고침 상태에서 이전상태가 성공인지, 에러인지를 또 분기처리를 해서 구현하는 것이 코드를 읽는 입장에서 가독성이 매우 떨어진다고 생각했습니다!
따라서 uiState에서 항상 뷰에 대한 내용을 가지고 있게 하기 위해 data class로 구현 후 Content를 넣어주었습니다.
| onRefresh: (ScheduleEventsUiState.Content) -> Unit, | ||
| modifier: Modifier = Modifier, | ||
| ) { | ||
| val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.pulse_circle)) |
There was a problem hiding this comment.
scheduleContent 라는 네이밍은 어떠신가요?
하위 컴포저블에서 uiState가 성공했는지, 실패했는지 굳이 알아야할 필요가 없을 것 같아요!
| successContent: ScheduleEventsUiState.Content.Success, | ||
| modifier: Modifier = Modifier, |
There was a problem hiding this comment.
etama123
left a comment
There was a problem hiding this comment.
네이밍 관련한 부분만 한 번만 더 확인해주세요 !
고생하셨습니다 ~
| ScheduleUiState( | ||
| content = scheduleUiStateContent, | ||
| ), | ||
| scheduleEventUiState = | ||
| ScheduleEventsUiState( | ||
| content = scheduleEventsUiStateContent, | ||
| isRefreshing = true, | ||
| ), |
There was a problem hiding this comment.
해당 코드만 봤을 때, 각각 어떤 content를 구성하는 지 모호하게 느껴집니다🥲
혹시 네이밍을 수정하는 건 어떨까요?
#️⃣ 이슈 번호
#48
🛠️ 작업 내용
🙇🏻 중점 리뷰 요청
문제가 생기면 그때 다시 픽스할게요. 그냥 억까였기를
📸 이미지 첨부 (Optional)
Screen_recording_20260206_014526.mp4