[Feature] 자체 qa#216
Hidden character warning
Conversation
📝 WalkthroughWalkthrough
ChangesCollectionDetail 북마크 최소 제한 초과 처리
SavedContent 북마크 토스트 및 OTT 바텀시트
프로필 수정 완료 후 ProfileScreen 자동 갱신
Sequence Diagram(s)sequenceDiagram
participant EditProfile as EditProfileRoute
participant MainNavHost as MainNavHost
participant SavedState as SavedStateHandle
participant ProfileNav as ProfileNavigation
participant ProfileRoute as ProfileRoute
participant ProfileVM as ProfileViewModel
rect rgba(59, 130, 246, 0.5)
Note over EditProfile,MainNavHost: 프로필 저장 완료
EditProfile->>MainNavHost: onProfileSaved()
MainNavHost->>SavedState: KEY_PROFILE_UPDATED = true
end
rect rgba(34, 197, 94, 0.5)
Note over SavedState,ProfileRoute: 갱신 신호 전파
SavedState-->>ProfileNav: collectAsStateWithLifecycle
ProfileNav->>ProfileRoute: shouldRefreshProfile = true
end
rect rgba(249, 115, 22, 0.5)
Note over ProfileRoute,ProfileVM: 프로필 헤더 재조회
ProfileRoute->>ProfileVM: reloadUserProfile()
ProfileVM-->>ProfileRoute: _uiState.profile 갱신
ProfileRoute->>ProfileNav: onProfileRefreshed()
ProfileNav->>SavedState: KEY_PROFILE_UPDATED = false
end
sequenceDiagram
participant Screen as CollectionDetailScreen
participant VM as CollectionDetailViewModel
participant Repo as BookmarkRepository
Screen->>VM: toggleContentBookmark(contentId)
alt 북마크 취소(!newBookmarkState)
VM->>VM: 즉시 bookmarkCount-1 상태 갱신
VM->>Repo: 저장소 토글 실행
Repo-->>VM: ContentMinLimitExceeded 예외
VM->>Screen: ToggleContentBookmarkMinLimitExceeded 방출
Screen->>Screen: OneButtonModal 표시
else 북마크 추가(newBookmarkState)
VM->>VM: adjustedBookmarkCount+1 상태 갱신
VM->>Repo: 디바운스 후 저장소 토글
Repo-->>VM: 실패 시 fallbackCount-1 롤백
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.kt (1)
129-138: 상수를 이용한 매직 넘버 제거 권장
SavedContentScreen에서는SavedContentUiState.MIN_REQUIRED_COUNT를 사용하여 최소 저장 개수를 표시합니다. 일관성과 유지보수성을 위해 이 화면에서도 동일한 상수를 참조해야 합니다. 현재 하드코딩된 "5개"를 상수로 변경하면 향후 값 변경 시 한 곳에서만 수정하면 됩니다.♻️ 제안 수정
if (showBookmarkRestrictionModal) { OneButtonModal( title = "작품 저장을 취소할 수 없어요", - message = "취향 키워드 분석을 위해\n최소 5개의 작품을 저장해주세요", + message = "취향 키워드 분석을 위해\n최소 ${SavedContentUiState.MIN_REQUIRED_COUNT}개의 작품을 저장해주세요", buttonText = "확인", onConfirm = { showBookmarkRestrictionModal = false }, onDismiss = { showBookmarkRestrictionModal = false }, icon = R.drawable.ic_gradient_bookmark, ) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.kt` around lines 129 - 138, The OneButtonModal in CollectionDetailScreen contains a hardcoded "5" in the message string for the bookmark restriction modal, but SavedContentUiState.MIN_REQUIRED_COUNT constant is already used elsewhere for the same purpose. Replace the hardcoded "5" in the message parameter with a reference to SavedContentUiState.MIN_REQUIRED_COUNT to ensure consistency across the codebase and allow future changes to be made in a single location.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/java/com/flint/presentation/profile/SavedContentViewModel.kt`:
- Around line 96-101: The totalCount calculation in the state update does not
have a lower bound check and can become negative when the -1 operation is
applied during unbookmarking, especially if the local state is out of sync. Fix
this by applying a minimum value constraint (coerce to at least 0) to the
totalCount value in the line where totalCount is calculated using the
conditional expression with if (isBookmarked) 1 else -1, ensuring the value
never goes below zero.
---
Nitpick comments:
In
`@app/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.kt`:
- Around line 129-138: The OneButtonModal in CollectionDetailScreen contains a
hardcoded "5" in the message string for the bookmark restriction modal, but
SavedContentUiState.MIN_REQUIRED_COUNT constant is already used elsewhere for
the same purpose. Replace the hardcoded "5" in the message parameter with a
reference to SavedContentUiState.MIN_REQUIRED_COUNT to ensure consistency across
the codebase and allow future changes to be made in a single location.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 59ac4db7-575e-42eb-91d2-62a1a4df0356
📒 Files selected for processing (13)
app/src/main/java/com/flint/core/designsystem/component/listView/SavedContentsSection.ktapp/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailScreen.ktapp/src/main/java/com/flint/presentation/collectiondetail/CollectionDetailViewModel.ktapp/src/main/java/com/flint/presentation/collectiondetail/sideeffect/CollectionDetailSideEffect.ktapp/src/main/java/com/flint/presentation/main/MainNavHost.ktapp/src/main/java/com/flint/presentation/profile/ProfileScreen.ktapp/src/main/java/com/flint/presentation/profile/ProfileViewModel.ktapp/src/main/java/com/flint/presentation/profile/SavedContentScreen.ktapp/src/main/java/com/flint/presentation/profile/SavedContentSideEffect.ktapp/src/main/java/com/flint/presentation/profile/SavedContentViewModel.ktapp/src/main/java/com/flint/presentation/profile/navigation/ProfileNavigation.ktapp/src/main/java/com/flint/presentation/setting/editprofile/EditProfileScreen.ktapp/src/main/java/com/flint/presentation/setting/editprofile/navigation/EditProfileNavigation.kt
| totalCount = currentList.totalCount + if (isBookmarked) 1 else -1, | ||
| contents = currentList.contents | ||
| .map { if (it.id == contentId) it.copy(isBookmarked = isBookmarked) else it } | ||
| .toPersistentList() | ||
| ) | ||
| state.copy(contents = UiState.Success(updated)) |
There was a problem hiding this comment.
totalCount 음수 하한 보정이 필요합니다.
Line 96은 -1 연산만 수행해서 로컬 상태가 어긋난 경우 음수 카운트가 노출될 수 있습니다. 하한을 0으로 고정해 주세요.
제안 패치
- totalCount = currentList.totalCount + if (isBookmarked) 1 else -1,
+ totalCount = (currentList.totalCount + if (isBookmarked) 1 else -1).coerceAtLeast(0),Based on learnings, toggle API 응답은 boolean 상태 중심으로 클라이언트에서 count를 계산하되 상태 동기화 안전성을 보장해야 합니다.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src/main/java/com/flint/presentation/profile/SavedContentViewModel.kt`
around lines 96 - 101, The totalCount calculation in the state update does not
have a lower bound check and can become negative when the -1 operation is
applied during unbookmarking, especially if the local state is out of sync. Fix
this by applying a minimum value constraint (coerce to at least 0) to the
totalCount value in the line where totalCount is calculated using the
conditional expression with if (isBookmarked) 1 else -1, ensuring the value
never goes below zero.
Source: Learnings
📌 작업 내용
Summary by CodeRabbit
릴리스 노트
새로운 기능
버그 수정