Conversation
공지사항 목록(`NoticeScreen`)에서 발생하던 레이아웃 제약을 해결하고, 로딩 실패나 데이터가 없는 경우에도 새로고침이 가능하도록 UI 구조를 개선했습니다.
- **`NoticeScreen.kt` 수정:**
- `rememberScrollState`를 추가하고 `ErrorStateScreen`과 `EmptyStateScreen`에 `verticalScroll`을 적용하여, 콘텐츠가 없을 때도 `PullToRefresh` 동작이 원활하게 작동하도록 수정했습니다.
- `NoticeUiState.Error` 상태일 때 기존에 아무것도 표시하지 않던 문제를 해결하기 위해 `ErrorStateScreen`을 추가했습니다.
- `NoticeContent` 컴포저블에 `scrollState` 파라미터를 추가하여 상태를 공유하도록 변경했습니다.
- `PullToRefreshContainer`에 `modifier`를 명시적으로 전달하여 레이아웃 유연성을 높였습니다.
- **`NewsViewModel.kt` 수정:**
- `updateNoticeUiState` 함수 내 `when` 식의 가독성을 위해 중괄호 블록을 추가했습니다. (코드 스타일 정리)
FAQ와 분실물(LostItem) 화면에서 에러 발생 시 로그만 출력하던 방식에서 `ErrorStateScreen`을 표시하도록 개선하고, 관련 컴포저블의 레이아웃 설정을 정돈했습니다.
- **`FAQScreen.kt` 수정:**
- `FAQUiState.Error` 상태일 때 `ErrorStateScreen`을 표시하도록 추가했습니다.
- 불필요한 `LaunchedEffect`를 제거하고 `Timber` 로그 출력을 직접 수행하도록 변경했습니다.
- **`LostItemScreen.kt` 수정:**
- `LostUiState.Error` 상태일 때 `ErrorStateScreen`을 표시하며, PullToRefresh 연동을 위해 `verticalScroll` 및 `graphicsLayer`를 적용했습니다.
- `PullToRefreshContainer`에 `modifier`를 전달하여 외부 레이아웃 설정을 반영하도록 수정했습니다.
- `EmptyStateScreen` 및 내부 리스트 컴포저블에 `modifier`를 적절히 전달하여 레이아웃 일관성을 확보했습니다.
- `LaunchedEffect` 내에 있던 로그 출력 로직을 밖으로 꺼내어 단순화했습니다.
공지사항 데이터의 상태 관리 방식을 개선하기 위해 `NoticeUiState`의 데이터 구조를 변경하고, 이를 반영하여 관련 ViewModel 및 UI 컴포저블을 리팩토링했습니다.
- **`NoticeUiState.kt` 수정:**
- 기존 `sealed interface` 방식에서 `data class` 구조로 변경했습니다.
- 화면의 주요 상태를 나타내는 `Content`를 중첩 `sealed interface`로 분리했습니다.
- `isRefreshing` 필드를 추가하여 새로고침 상태를 명시적으로 관리하도록 개선했습니다.
- **`NewsViewModel.kt` 수정:**
- 변경된 `NoticeUiState` 구조에 맞춰 초기화 및 데이터 로드 로직을 수정했습니다.
- `expandNotice` 및 `updateNoticeUiState`에서 상태 확인 로직을 `Content` 타입을 체크하는 방식으로 업데이트했습니다.
- **`NoticeScreen.kt` 수정:**
- `isRefreshing` 파라미터를 제거하고 `uiState.isRefreshing`을 직접 참조하도록 변경했습니다.
- `uiState.content`에 따른 상태 분기 처리(`InitialLoading`, `Success`, `Error`)를 적용했습니다.
- **`NewsScreen.kt` & `NewsTabPage.kt` 수정:**
- `NoticeScreen` 호출 시 불필요해진 `isNoticeRefreshing` 전달 로직을 제거했습니다.
- 새로고침 시 `noticeUiState.copy(isRefreshing = true)`를 사용하여 상태를 업데이트하도록 변경했습니다.
분실물 화면의 `LostUiState`를 데이터 클래스 구조로 변경하고, 새로고침 상태(`isRefreshing`)를 필드로 통합하여 상태 관리의 일관성을 높였습니다.
- **`LostUiState.kt` 수정:**
- 기존 `sealed interface` 방식에서 `content`와 `isRefreshing`을 포함하는 `data class`로 변경했습니다.
- 기존 상태값들을 `Content` 내부 `sealed interface`로 계층화했습니다.
- **`NewsViewModel.kt` 수정:**
- 변경된 `LostUiState` 구조에 맞춰 초기화 및 상태 업데이트 로직을 수정했습니다.
- `updateLostUiState` 내에서 `Success` 상태일 때만 데이터를 업데이트하도록 안전한 타입 캐스팅 로직을 개선했습니다.
- **`NewsScreen.kt` & `NewsTabPage.kt` 수정:**
- 별도로 관리하던 `isLostItemRefreshing` 변수를 제거하고 `LostUiState` 내부의 필드를 사용하도록 파라미터를 정리했습니다.
- **`LostItemScreen.kt` 수정:**
- `isRefreshing` 파라미터를 제거하고 `lostUiState.isRefreshing`을 직접 참조하도록 변경했습니다.
- 불필요해진 `LostUiState.Refreshing` 분기 처리를 제거하고 통합된 상태 모델을 반영했습니다.
`NoticeUiState` 및 `LostUiState` 데이터 구조 변경에 따라 테스트 코드를 수정하고, 테스트 디스패처를 변경하여 비동기 테스트 로직을 간소화했습니다.
- **테스트 환경 설정 변경:**
- `StandardTestDispatcher`를 `UnconfinedTestDispatcher`로 변경하여 `advanceUntilIdle()` 호출 없이도 코루틴 작업이 즉시 실행되도록 개선했습니다.
- **UiState 변경 사항 반영:**
- `NoticeUiState`와 `LostUiState`가 sealed class에서 일반 data class(내부에 `Content` sealed interface 포함) 구조로 변경됨에 따라, 테스트 코드 내의 객체 생성 로직을 `NoticeUiState(content = ...)` 형태로 수정했습니다.
- **테스트 케이스 정리:**
- `loadAllNotices`, `loadAllLostItems`, `toggleNotice`, `expandNotice` 등 주요 메서드에 대한 검증 로직에서 변경된 상태 구조를 반영하여 기댓값(expected)을 업데이트했습니다.
- 불필요해진 `advanceUntilIdle()` 호출을 제거하여 테스트 코드의 가독성을 높였습니다.
|
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)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
`LostItemScreen`의 레이아웃을 `Box`로 감싸 빈 화면(`EmptyStateScreen`)과 리스트(`LazyVerticalGrid`)가 적절히 중첩될 수 있도록 구조를 개선하고, `modifier` 적용 범위를 수정했습니다.
- **`LostItemScreen.kt` 수정:**
- 전체 컴포넌트를 `Box`로 감싸고 전달받은 `modifier`를 적용했습니다.
- 리스트가 비어있을 때 표시되는 `EmptyStateScreen`에 중복 적용되던 `modifier`를 제거했습니다.
- `LazyVerticalGrid`에 개별적으로 적용되던 `modifier`를 제거하여 `Box` 내부 레이아웃 흐름에 맞게 조정했습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣ 이슈 번호
#52
🛠️ 작업 내용
🙇🏻 중점 리뷰 요청
📸 이미지 첨부 (Optional)
분실물화면
Screen_recording_20260215_180056.mp4
소식화면
Screen_recording_20260211_181416.mp4