✨ :: (#448) 알림 읽음/안읽음 필터링 구현#449
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Walkthrough알림 목록 요청은 쿼리 파라미터 없이 구성되며, 알림 화면에 전체/안읽음/읽음 필터가 추가되었습니다. Changes알림 필터 요청·표시 흐름
Sequence Diagram(s)sequenceDiagram
participant User
participant AlarmViewController
participant AlarmReactor
User->>AlarmViewController: 필터 세그먼트 선택
AlarmViewController->>AlarmReactor: filterChanged 액션 전달
AlarmReactor-->>AlarmViewController: filter와 filteredList 갱신
AlarmViewController-->>User: 필터된 알림 목록 표시
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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: 2
🤖 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 `@Projects/Data/Sources/DataSource/API/NotificationsAPI.swift`:
- Around line 52-55: `NotificationsAPI.task`에서 `fetchNotificationList`가
`requestPlain`으로 바뀌며 서버 필터링용 입력이 사라졌습니다. `fetchNotificationList`의 case 정의를
`isNew: Bool?`를 받도록 유지하고, `task`에서 값이 있을 때만 `is_new` 파라미터를 포함해 요청하도록 복구하세요.
`NotificationsAPI`와 `task`의 연동을 원래 PR 목적에 맞게 되돌려 클라이언트 분기 대신 서버 필터링이 적용되게 하세요.
In `@Projects/Presentation/Sources/Home/Alarm/AlarmViewController.swift`:
- Around line 68-69: The filtered table selection is currently being treated as
a raw original-array index, which can update the wrong notification. Update the
AlarmViewController bindState/select flow and the readNotification reducer so
selection is resolved by notificationID (preferred) or by mapping the filtered
row back to the original notificationList index before mutation. Use the
existing filteredList rendering and the readNotification / notificationList
symbols to ensure the tapped item is the one that gets marked read.
🪄 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: e1e14abd-089f-4683-b947-1f191ff32b92
📒 Files selected for processing (3)
Projects/Data/Sources/DataSource/API/NotificationsAPI.swiftProjects/Presentation/Sources/Home/Alarm/AlarmReactor.swiftProjects/Presentation/Sources/Home/Alarm/AlarmViewController.swift
| public var task: Task { | ||
| switch self { | ||
| case .fetchNotificationList: | ||
| return .requestParameters( | ||
| parameters: | ||
| // // TODO: 추후 읽음와 안읽음 분기처리 필요 | ||
| ["is_new": ""], | ||
| encoding: URLEncoding.queryString) | ||
| return .requestPlain |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
서버 필터링 경로가 사라졌습니다.
requestPlain으로 바뀌면서 fetchNotificationList가 isNew를 전달할 입력 자체를 잃었습니다. 지금 상태에서는 화면에서 이미 받아온 목록만 클라이언트에서 나누게 되므로, 응답이 페이징되거나 일부만 내려오면 읽음/안읽음 탭 결과가 불완전해집니다. PR 목표대로 fetchNotificationList(isNew: Bool?)를 유지하고, 값이 있을 때만 is_new를 붙이는 형태로 복구해야 합니다.
🤖 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 `@Projects/Data/Sources/DataSource/API/NotificationsAPI.swift` around lines 52
- 55, `NotificationsAPI.task`에서 `fetchNotificationList`가 `requestPlain`으로 바뀌며 서버
필터링용 입력이 사라졌습니다. `fetchNotificationList`의 case 정의를 `isNew: Bool?`를 받도록 유지하고,
`task`에서 값이 있을 때만 `is_new` 파라미터를 포함해 요청하도록 복구하세요. `NotificationsAPI`와 `task`의
연동을 원래 PR 목적에 맞게 되돌려 클라이언트 분기 대신 서버 필터링이 적용되게 하세요.
| public override func bindState() { | ||
| reactor.state.map { $0.notificationList } | ||
| reactor.state.map { $0.filteredList } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
필터된 row index를 원본 배열 index로 재사용하면 잘못된 항목이 갱신됩니다.
이제 테이블이 filteredList를 렌더링하므로 선택된 row는 필터된 배열 기준입니다. 그런데 현재 흐름은 그 값을 그대로 readNotification에 넘기고, 리듀서는 notificationList[index]를 수정하므로 .unread/.read 탭에서는 탭한 알림이 아닌 다른 원본 항목이 덮어써질 수 있습니다. index 대신 notificationID로 원본 배열을 찾아 갱신하거나, 선택 시 원본 배열 기준 index를 전달해야 합니다.
🤖 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 `@Projects/Presentation/Sources/Home/Alarm/AlarmViewController.swift` around
lines 68 - 69, The filtered table selection is currently being treated as a raw
original-array index, which can update the wrong notification. Update the
AlarmViewController bindState/select flow and the readNotification reducer so
selection is resolved by notificationID (preferred) or by mapping the filtered
row back to the original notificationList index before mutation. Use the
existing filteredList rendering and the readNotification / notificationList
symbols to ensure the tapped item is the one that gets marked read.
Summary
NotificationsAPI.fetchNotificationList의 의미없는["is_new": ""]파라미터 제거 →.requestPlain으로 교체AlarmReactor에NotificationFilterenum(all/unread/read) 및 클라이언트 사이드 필터 로직 추가AlarmViewController에 세그먼트 컨트롤(전체/안읽음/읽음) UI 추가 및filteredList바인딩Changes
NotificationsAPI.swiftis_new파라미터 제거, TODO 주석 제거AlarmReactor.swiftNotificationFilterenum,filterChangedAction,setFilterMutation,filteredListcomputed property 추가AlarmViewController.swiftUISegmentedControl추가,filteredList바인딩Test plan
new == true항목만 표시 확인new == false항목만 표시 확인Closes #448
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes