Skip to content

Fix/#476 공통퀘스트 댓글 노출/더보기/작성시간 오류 수정#477

Open
juri123123 wants to merge 2 commits into
developfrom
fix/#476-공통-퀘스트-댓글-안보이는-오류-수정

Hidden character warning

The head ref may contain hidden characters: "fix/#476-\uacf5\ud1b5-\ud018\uc2a4\ud2b8-\ub313\uae00-\uc548\ubcf4\uc774\ub294-\uc624\ub958-\uc218\uc815"
Open

Fix/#476 공통퀘스트 댓글 노출/더보기/작성시간 오류 수정#477
juri123123 wants to merge 2 commits into
developfrom
fix/#476-공통-퀘스트-댓글-안보이는-오류-수정

Conversation

@juri123123

@juri123123 juri123123 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

🔗 연결된 이슈

📄 작업 내용

  • 공통퀘스트 댓글 목록에서 댓글 content가 기기별로 안 보이거나, 길이와 무관하게 "더보기" 버튼이 잘못 노출/미노출되던 문제를 수정했습니다.
  • 댓글/답변 작성 시각이 실제 경과 시간과 무관하게 항상 "방금 전"으로 표시되던 문제를 수정했습니다.

✅ Testing

  • 테스트 목적과 상황: 공통퀘스트 상세 화면에서 댓글 content 노출, "더보기" 버튼 정확도, 작성 시각 상대 표기가 기기 크기와 무관하게 정상 동작하는지 확인
  • 시나리오 진행에 필요한 값: 5줄을 넘는 긴 댓글, 5줄이 안 되는 짧은 댓글
  • 시나리오 진행에 필요한 조건: 공통퀘스트 답변에 댓글이 1개 이상 달려 있어야 함
  • 시나리오 완료 시 보장하는 결과:
    • 5줄이 넘는 댓글은 본문이 정상적으로 보이고 "더보기"가 노출되며, 탭하면 전체 내용이 펼쳐진다.
    • 5줄이 안 되는 댓글은 "더보기"가 노출되지 않고 본문이 잘리지 않는다.
    • iPhone 16 Pro / iPhone 13 mini 등 화면 크기가 달라도 위 동작이 동일하다.
    • 댓글/답변 작성 시각이 실제 경과 시간에 맞게 "N분 전"/"N시간 전"으로 표시된다.

💻 주요 코드 설명

CommentTableViewCell

  • commentListView가 스크롤 없는 self-sizing 테이블이라 일반 테이블처럼 셀이 보일 때마다 layoutSubviews()가 자연스럽게 재호출되지 않아, configure()에서 layoutIfNeeded()로 직접 트리거하도록 변경
  • 텍스트 폭이 이 기기 화면 기준으로 확정된 뒤(layoutSubviews() 이후)에만 "더보기" 노출 여부를 계산하도록 이동
  • 줄 잘림 여부 판단을 TextKittruncatedGlyphRange(inLineFragmentForGlyphAt:)로 교체(글자 수 비교 방식은 잘린 마지막 줄의 글자를 전부 포함시켜 반환해 판단이 부정확했음)
override func layoutSubviews() {
    super.layoutSubviews()
    let width = commentTextView.bounds.width
    guard width > 0, width != lastTruncationWidth else { return }
    lastTruncationWidth = width
    updateTextTruncation()
}

ServerDateFormatter

  • 서버가 보내는 writtenAt은 타임존 오프셋이 없는 로컬(KST) 시각인데, formatter가 이를 UTC로 강제 파싱해 실제보다 9시간 미래로 해석됨 → diff가 음수가 되어 항상 "방금 전" 분기에 걸리던 문제
  • timeZone 강제 지정을 제거해 다른 포맷터(DateFormatter+.swift)와 동일하게 기기 로컬 타임존을 쓰도록 통일

👀 기타 더 이야기해볼 점

  • applyStyleWhenHideText()의 "더보기" 위치 계산(exclusionRect)은 여전히 픽셀 좌표를 직접 계산하는 방식이라 폰트/스타일이 바뀌면 다시 깨질 수 있습니다. 추후 여유 있을 때 더 견고한 방식으로 리팩터링을 고려해봐도 좋을 것 같습니다.

Summary by CodeRabbit

  • 개선 사항

    • 댓글 텍스트의 실제 표시 영역을 기준으로 “더보기” 버튼과 접힘 상태가 정확하게 표시됩니다.
    • 화면 너비나 레이아웃 변경 시 댓글 잘림 상태가 자동으로 다시 계산됩니다.
    • 날짜와 시간 표시가 기기 환경에 맞는 시간대를 따르도록 개선되었습니다.
  • 기타

    • 앱 및 테스트 빌드 버전이 14로 업데이트되었습니다.

@juri123123 juri123123 linked an issue Jul 21, 2026 that may be closed by this pull request
1 task
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

앱·테스트 빌드 버전을 14로 갱신하고, 서버 날짜 포맷터의 UTC 고정을 제거했습니다. 댓글 셀은 폭 변화와 실제 glyph truncation을 기준으로 더보기 표시를 계산하도록 변경되었습니다.

Changes

댓글 텍스트 접힘 처리

Layer / File(s) Summary
폭 기반 댓글 truncation 계산
ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/Quest/View/CommonQuest/Cells/CommentTableViewCell.swift
댓글 셀이 폭 변경 시 truncation을 재계산하고, glyph 레벨의 실제 잘림 여부에 따라 더보기 및 exclusion 영역을 갱신합니다.
셀프사이징 동작 설명
ByeBoo-iOS/ByeBoo-iOS/Presentation/Extension/UITableView+.swift
SelfSizingTableView의 콘텐츠 높이 기반 확장 동작을 설명하는 주석이 추가되었습니다.

서버 날짜 포맷 설정

Layer / File(s) Summary
날짜 포맷터 타임존 변경
ByeBoo-iOS/ByeBoo-iOS/Data/Model/Util/ServerDateFormatter.swift
DateFormatter의 명시적인 UTC 타임존 설정이 제거되었습니다.

빌드 버전 갱신

Layer / File(s) Summary
앱·테스트 타깃 버전 갱신
ByeBoo-iOS/ByeBoo-iOS.xcodeproj/project.pbxproj
앱 및 테스트 타깃의 Debug와 Release 설정에서 CURRENT_PROJECT_VERSION이 14로 변경되었습니다.

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: 숨김 상태 갱신
Loading

Suggested reviewers: y-eonee, y-eonee

Poem

토끼가 댓글 폭을 살피네
잘린 글자엔 더보기를 달고
넓어진 칸엔 다시 펼치고
날짜와 버전도 새 단장했네
깡충, 깔끔한 변경 만세! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 공통퀘스트 댓글 노출, 더보기, 작성시간 수정이라는 변경 사항을 정확히 요약한 제목입니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#476-공통-퀘스트-댓글-안보이는-오류-수정

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b5f97fb and e108934.

📒 Files selected for processing (4)
  • ByeBoo-iOS/ByeBoo-iOS.xcodeproj/project.pbxproj
  • ByeBoo-iOS/ByeBoo-iOS/Data/Model/Util/ServerDateFormatter.swift
  • ByeBoo-iOS/ByeBoo-iOS/Presentation/Extension/UITableView+.swift
  • ByeBoo-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

Comment on lines 306 to 308
let contentHeight = commentTextView.sizeThatFits(
CGSize(width: commentTextView.bounds.width, height: .infinity)
).height

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Suggested change
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.

@y-eonee y-eonee changed the title fix: #476 공통퀘스트 댓글 노출/더보기/작성시간 오류 수정 Fix/#476 공통퀘스트 댓글 노출/더보기/작성시간 오류 수정 Jul 24, 2026

@dev-domo dev-domo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다!

formatter.do {
$0.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
$0.locale = Locale(identifier: "en_US_POSIX")
$0.timeZone = TimeZone(secondsFromGMT: 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 제거해주신 거군요! 감사합니다

// intrinsicContentSize가 없어 콘텐츠 크기만큼 스스로 커지지 못한다.
// isScrollEnabled = false로 쓰고 contentSize를 intrinsicContentSize로 노출시켜,
// 바깥 UIScrollView 안에 스크롤 없이 끼워넣어도 콘텐츠 높이에 맞게 자동으로 커지게 한다.
final class SelfSizingTableView: UITableView {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그럼 콘텐츠 크기에 동적으로 반응해야 하는 테이블 뷰는 모두 UITableView가 아닌 SelfSizingTableView를 상속해야 하는 걸까요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SelfSizingTableView는 스크롤 없이 상위 스크롤뷰에 끼워 넣는 테이블뷰에 필요하다고 이해했습니다. . .
CommonQuestReplyView처럼 리스트가 화면의 유일한 스크롤 영역이면 평범한 UITableView로 충분하고, CommonQuestHistoryView처럼 질문/답변과 함께 하나의 스크롤 안에 얹혀야 할 때만 SelfSizingTableView를 사용해주면 될 것 같아요 !

혹시 아니라면 꼬옥 알려주길 바랍니다 . . .
@y-eonee @dev-domo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 공통 퀘스트 댓글 안보이는 오류 수정

2 participants