Fix/#476 공통퀘스트 댓글 노출/더보기/작성시간 오류 수정#477
Hidden character warning
Conversation
Walkthrough앱·테스트 빌드 버전을 14로 갱신하고, 서버 날짜 포맷터의 UTC 고정을 제거했습니다. 댓글 셀은 폭 변화와 실제 glyph truncation을 기준으로 더보기 표시를 계산하도록 변경되었습니다. Changes댓글 텍스트 접힘 처리
서버 날짜 포맷 설정
빌드 버전 갱신
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CommentTableViewCell
participant layoutManager
participant moreLabel
CommentTableViewCell->>layoutManager: 현재 폭과 glyph 잘림 여부 계산
layoutManager-->>CommentTableViewCell: truncatedGlyphRange 반환
CommentTableViewCell->>moreLabel: 숨김 상태 갱신
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 1
🤖 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
`@ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/Quest/View/CommonQuest/Cells/CommentTableViewCell.swift`:
- Around line 306-308: Update the sizeThatFits call calculating contentHeight in
CommentTableViewCell to use CGFloat.greatestFiniteMagnitude for the CGSize
height instead of .infinity, matching the existing safe sizing approach
elsewhere in the cell.
🪄 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: bd509608-29a8-4084-a1cd-3374c197d7d6
📒 Files selected for processing (4)
ByeBoo-iOS/ByeBoo-iOS.xcodeproj/project.pbxprojByeBoo-iOS/ByeBoo-iOS/Data/Model/Util/ServerDateFormatter.swiftByeBoo-iOS/ByeBoo-iOS/Presentation/Extension/UITableView+.swiftByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/Quest/View/CommonQuest/Cells/CommentTableViewCell.swift
💤 Files with no reviewable changes (1)
- ByeBoo-iOS/ByeBoo-iOS/Data/Model/Util/ServerDateFormatter.swift
| let contentHeight = commentTextView.sizeThatFits( | ||
| CGSize(width: commentTextView.bounds.width, height: .infinity) | ||
| ).height |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
CGFloat.infinity 대신 CGFloat.greatestFiniteMagnitude 사용을 권장합니다.
sizeThatFits에 .infinity를 전달하면 내부적으로 CoreGraphics 연산 시 의도치 않은 동작이나 충돌이 발생할 위험이 있습니다. 안전하게 최대 크기를 지정하려면 284번째 줄에서 사용하신 것처럼 .greatestFiniteMagnitude를 사용하는 것이 좋습니다.
💻 수정 제안
let contentHeight = commentTextView.sizeThatFits(
- CGSize(width: commentTextView.bounds.width, height: .infinity)
+ CGSize(width: commentTextView.bounds.width, height: .greatestFiniteMagnitude)
).height📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let contentHeight = commentTextView.sizeThatFits( | |
| CGSize(width: commentTextView.bounds.width, height: .infinity) | |
| ).height | |
| let contentHeight = commentTextView.sizeThatFits( | |
| CGSize(width: commentTextView.bounds.width, height: .greatestFiniteMagnitude) | |
| ).height |
🤖 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
`@ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/Quest/View/CommonQuest/Cells/CommentTableViewCell.swift`
around lines 306 - 308, Update the sizeThatFits call calculating contentHeight
in CommentTableViewCell to use CGFloat.greatestFiniteMagnitude for the CGSize
height instead of .infinity, matching the existing safe sizing approach
elsewhere in the cell.
| formatter.do { | ||
| $0.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS" | ||
| $0.locale = Locale(identifier: "en_US_POSIX") | ||
| $0.timeZone = TimeZone(secondsFromGMT: 0) |
| // intrinsicContentSize가 없어 콘텐츠 크기만큼 스스로 커지지 못한다. | ||
| // isScrollEnabled = false로 쓰고 contentSize를 intrinsicContentSize로 노출시켜, | ||
| // 바깥 UIScrollView 안에 스크롤 없이 끼워넣어도 콘텐츠 높이에 맞게 자동으로 커지게 한다. | ||
| final class SelfSizingTableView: UITableView { |
There was a problem hiding this comment.
그럼 콘텐츠 크기에 동적으로 반응해야 하는 테이블 뷰는 모두 UITableView가 아닌 SelfSizingTableView를 상속해야 하는 걸까요?
There was a problem hiding this comment.
🔗 연결된 이슈
📄 작업 내용
✅ Testing
💻 주요 코드 설명
CommentTableViewCellcommentListView가 스크롤 없는 self-sizing 테이블이라 일반 테이블처럼 셀이 보일 때마다layoutSubviews()가 자연스럽게 재호출되지 않아,configure()에서layoutIfNeeded()로 직접 트리거하도록 변경layoutSubviews()이후)에만 "더보기" 노출 여부를 계산하도록 이동TextKit의truncatedGlyphRange(inLineFragmentForGlyphAt:)로 교체(글자 수 비교 방식은 잘린 마지막 줄의 글자를 전부 포함시켜 반환해 판단이 부정확했음)ServerDateFormatterwrittenAt은 타임존 오프셋이 없는 로컬(KST) 시각인데, formatter가 이를 UTC로 강제 파싱해 실제보다 9시간 미래로 해석됨 →diff가 음수가 되어 항상 "방금 전" 분기에 걸리던 문제timeZone강제 지정을 제거해 다른 포맷터(DateFormatter+.swift)와 동일하게 기기 로컬 타임존을 쓰도록 통일👀 기타 더 이야기해볼 점
applyStyleWhenHideText()의 "더보기" 위치 계산(exclusionRect)은 여전히 픽셀 좌표를 직접 계산하는 방식이라 폰트/스타일이 바뀌면 다시 깨질 수 있습니다. 추후 여유 있을 때 더 견고한 방식으로 리팩터링을 고려해봐도 좋을 것 같습니다.Summary by CodeRabbit
개선 사항
기타