Skip to content

Conversation

@m6z1
Copy link
Member

@m6z1 m6z1 commented Jun 26, 2025

📌𝘐𝘴𝘴𝘶𝘦𝘴

📎𝘞𝘰𝘳𝘬 𝘋𝘦𝘴𝘤𝘳𝘪𝘱𝘵𝘪𝘰𝘯

  • 피드 > 피드 상세로 이동 시 현재 내가 누른 좋아요 상태를 넘겨 상세 보기에서 이전 피드에서 나의 좋아요로 반영될 수 있도록 수정했습니다.
  • 피드 상세 > 피드로 이동 시 현재 내가 상세뷰에서 누른 좋아요 상태를 넘겨 피드 뷰에서 이전 상세보기뷰의 나의 좋아요로 반영될 수 있도록 수정했습니다.

📷𝘚𝘤𝘳𝘦𝘦𝘯𝘴𝘩𝘰𝘵

주디 QA 완!

default.mp4

💬𝘛𝘰 𝘙𝘦𝘷𝘪𝘦𝘸𝘦𝘳𝘴

(고민인 점)

  1. 디바운스로 인해서 (어디서든) 좋아요를 눌러도 뷰모델로 업데이트는 조금 늦게 됨
  2. 각 화면 이동 시 뷰모델에 있는 isLiked 값을 intent에 넣음
  3. 디바운스가 걸려있어 이 시간 전에 화면 이동 시 뷰모델의 값이 업데이트 되기 전 값으로 넣어짐
  4. 따라서 디바운스를 0.1초로 수정했는데, 다른 좋은 방법이 있을까요!?
스크린샷 2025-06-26 오후 7 20 38

해당 함수 이름은 ,, 함수의 시그니처가 같아서 오버로딩이 불가능 해 updatedLike2로 지음 .. ㅋㅋ 이 또한 다른 좋은 함수 네이밍도 추천 받습니다
updateLikedSync 로 변경!

Summary by CodeRabbit

Summary by CodeRabbit

  • 신규 기능

    • 피드 상세 화면 진입 시 좋아요 상태를 함께 전달하고, 상세 화면에서 돌아올 때 변경된 좋아요 상태와 개수를 피드 목록에 반영할 수 있도록 개선되었습니다.
    • 피드 목록에서 좋아요 상태와 개수를 동기화하는 기능이 추가되었습니다.
  • 버그 수정

    • 좋아요 버튼 클릭 시 딜레이(100ms)가 명확하게 적용되어 중복 클릭이 방지됩니다.
  • UI/UX 개선

    • 피드 아이템 클릭 시 좋아요 상태가 함께 전달되어 상세 화면과 목록 화면의 좋아요 상태 동기화가 원활해졌습니다.

@github-actions github-actions bot requested review from junseo511, s9hn and yeonjeen June 26, 2025 10:21
@m6z1 m6z1 added 🏹 궁사 명지 웹소소 공주의 은밀한 사냥생활 🔨 [FIX] 버그를 수정합니다. labels Jun 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 26, 2025

"""

Walkthrough

피드 상세 화면과 피드 목록 화면 간의 좋아요 상태와 카운트 동기화 로직이 추가 및 수정되었습니다. 인텐트와 뷰모델, UI 콜백 등에서 좋아요 상태와 카운트를 전달하고 반영하는 코드가 일괄적으로 적용되었습니다. 클릭 이벤트의 디바운스 시간도 명시적으로 지정되었습니다.

Changes

파일/경로 그룹 변경 요약
.../FeedDetailActivity.kt, .../FeedDetailViewModel.kt 피드 상세 진입 시 좋아요 상태 전달 및 반영, 결과 인텐트에 좋아요 상태/카운트 포함, 관련 프로퍼티 및 상수 추가, ViewModel에 isLiked 파라미터 추가
.../FeedFragment.kt, .../FeedViewModel.kt 피드 상세에서 돌아올 때 좋아요 상태/카운트 반영, 상세 진입 시 isLiked 전달, 새로운 updateLikedSync 함수 추가
.../FeedItemClickListener.kt, .../NovelFeedFragment.kt onContentClick에 isLiked 파라미터 추가, 상세 진입 시 isLiked 전달 방식 변경
.../item_feed.xml onContentClick에 feed.id와 feed.isLiked 모두 전달하도록 데이터 바인딩 수정

Sequence Diagram(s)

sequenceDiagram
    participant FeedFragment
    participant FeedDetailActivity
    participant FeedDetailViewModel
    participant FeedViewModel

    FeedFragment->>FeedDetailActivity: startActivityForResult(feedId, isLiked)
    FeedDetailActivity->>FeedDetailViewModel: updateFeedDetail(feedId, from, isLiked)
    FeedDetailViewModel-->>FeedDetailActivity: UI 상태 업데이트
    FeedDetailActivity-->>FeedFragment: setResult(feedId, isLiked, likeCount)
    FeedFragment->>FeedViewModel: updateLikedSync(feedId, isLiked, likeCount)
    FeedViewModel-->>FeedFragment: UI 상태 반영
Loading

Assessment against linked issues

Objective Addressed Explanation
피드 <-> 피드 상세 간 좋아요 싱크 맞지 않는 이슈 해결 (#677)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)

Possibly related issues

Suggested labels

♻️ [REFACTOR]

Suggested reviewers

  • yeonjeen
  • s9hn

Poem

🐰
피드 좋아요, 싱크 맞춰
상세도 목록도 함께 춤춰
토글 한 번, 숫자도 척척
토끼는 기뻐 깡총깡총
코드도 마음도 싱크로율 100!
🥕
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66be175 and 8ca16b7.

📒 Files selected for processing (2)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (7 hunks)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedViewModel.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedViewModel.kt
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (1)

373-383: updatedLike2 메서드명 개선을 고려해보세요.

현재 updatedLike2라는 네이밍은 임시적인 해결책으로 보입니다. 함수 오버로딩 문제로 인해 "2" 접미사를 사용한 것으로 이해되지만, 더 명확한 네이밍을 고려해보는 것이 좋겠습니다.

다음과 같은 네이밍을 고려해보세요:

  • updateLikeFromDetail
  • updateLikeWithFeedId
  • synchronizeLikeStatus
-                feedViewModel.updatedLike2(
+                feedViewModel.updateLikeFromDetail(
                    selectedFeedId = updatedFeedId,
                    isLiked = updatedLikeStatus,
                    updatedLikeCount = updatedLikeCount,
                )
app/src/main/java/com/into/websoso/ui/feedDetail/FeedDetailActivity.kt (1)

572-573: 상수 네이밍의 일관성을 개선하세요.

FEED_LIKE_STATUSFEED_DETAIL_LIKE_STATUS 두 개의 유사한 상수가 존재하는데, 이는 혼란을 야기할 수 있습니다.

더 명확한 네이밍을 고려해보세요:

        const val FEED_ID: String = "FEED_ID"
-       const val FEED_DETAIL_LIKE_STATUS: String = "FEED_DETAIL_LIKE_STATUS"
+       const val FEED_LIKE_STATUS_RESULT: String = "FEED_LIKE_STATUS_RESULT"
        const val FEED_LIKE_COUNT: String = "FEED_LIKE_COUNT"
        private const val DEFAULT_FEED_ID: Long = -1
        private const val NOTIFICATION_ID: String = "NOTIFICATION_ID"
-       private const val FEED_LIKE_STATUS: String = "FEED_LIKE_STATUS"
+       private const val FEED_LIKE_STATUS_INPUT: String = "FEED_LIKE_STATUS_INPUT"

이렇게 하면 입력용과 결과용 상수를 명확히 구분할 수 있습니다.

Also applies to: 576-576, 583-583, 588-588

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06c2f69 and 66be175.

📒 Files selected for processing (7)
  • app/src/main/java/com/into/websoso/ui/feedDetail/FeedDetailActivity.kt (5 hunks)
  • app/src/main/java/com/into/websoso/ui/feedDetail/FeedDetailViewModel.kt (2 hunks)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (7 hunks)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedItemClickListener.kt (1 hunks)
  • app/src/main/java/com/into/websoso/ui/main/feed/FeedViewModel.kt (1 hunks)
  • app/src/main/java/com/into/websoso/ui/novelFeed/NovelFeedFragment.kt (2 hunks)
  • app/src/main/res/layout/item_feed.xml (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
app/src/main/java/com/into/websoso/ui/novelFeed/NovelFeedFragment.kt (4)
app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (1)
  • navigateToFeedDetail (373-384)
app/src/main/java/com/into/websoso/ui/main/home/HomeFragment.kt (1)
  • navigateToFeedDetail (285-292)
app/src/main/java/com/into/websoso/ui/novelDetail/NovelDetailActivity.kt (1)
  • showLoginRequestDialog (380-383)
app/src/main/java/com/into/websoso/ui/main/MainActivity.kt (1)
  • showLoginRequestDialog (139-142)
app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (2)
app/src/main/java/com/into/websoso/ui/novelFeed/NovelFeedFragment.kt (1)
  • navigateToFeedDetail (258-273)
app/src/main/java/com/into/websoso/ui/main/home/HomeFragment.kt (1)
  • navigateToFeedDetail (285-292)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (15)
app/src/main/java/com/into/websoso/ui/main/feed/FeedItemClickListener.kt (1)

17-20: 인터페이스 업데이트가 적절합니다.

좋아요 상태 동기화를 위한 isLiked 매개변수 추가가 명확하고 일관성 있게 구현되었습니다.

app/src/main/res/layout/item_feed.xml (2)

21-21: 데이터바인딩 표현식이 올바르게 업데이트되었습니다.

피드 아이템 클릭 시 좋아요 상태도 함께 전달하도록 적절히 수정되었습니다.


101-101: 스포일러 경고 클릭 핸들러도 일관성 있게 업데이트되었습니다.

일반 콘텐츠 클릭과 동일한 매개변수를 전달하여 일관성을 유지했습니다.

app/src/main/java/com/into/websoso/ui/novelFeed/NovelFeedFragment.kt (2)

105-110: 인터페이스 구현이 올바르게 업데이트되었습니다.

isLiked 매개변수를 받아 네비게이션 메서드로 전달하는 로직이 적절합니다.


258-273: 네비게이션 방식 변경을 확인해주세요.

activityResultCallback.launch에서 startActivity로 변경되었는데, 이는 피드 상세 화면에서 돌아올 때 좋아요 상태 업데이트를 받지 않는다는 의미입니다. 이것이 의도된 동작인지 확인이 필요합니다.

다음 스크립트로 FeedFragment와의 일관성을 확인해보세요:

#!/bin/bash
# FeedFragment와 NovelFeedFragment의 네비게이션 방식 비교
echo "=== FeedFragment의 navigateToFeedDetail 메서드 ==="
ast-grep --pattern 'private fun navigateToFeedDetail($$$) {
  $$$
}'

echo "=== 두 Fragment의 activityResultCallback 사용 패턴 ==="
rg -A 10 "activityResultCallback.launch.*FeedDetailActivity"
app/src/main/java/com/into/websoso/ui/feedDetail/FeedDetailViewModel.kt (2)

47-47: 매개변수 추가가 적절합니다.

기본값 false를 제공하여 기존 코드와의 호환성을 유지했습니다.


68-81: 좋아요 상태 동기화 로직이 잘 구현되었습니다.

세 가지 케이스를 명확히 처리하여 피드 목록에서 전달된 좋아요 상태와 서버에서 받은 데이터 간의 차이를 적절히 조정했습니다.

  • 상태가 동일한 경우: 변경 없음
  • 좋아요 취소된 경우: 카운트 감소
  • 좋아요 추가된 경우: 카운트 증가
app/src/main/java/com/into/websoso/ui/main/feed/FeedFragment.kt (5)

29-29: Import 구문 추가가 적절합니다.

피드 상세 화면과의 동기화를 위한 필요한 상수들이 정확하게 import되었습니다.

Also applies to: 55-55, 57-57


155-165: 좋아요 상태 동기화 로직이 올바르게 구현되었습니다.

FeedDetailBack.RESULT_OK 케이스를 통해 피드 상세에서 돌아올 때 좋아요 상태와 카운트를 적절히 업데이트하고 있습니다. Intent에서 값을 안전하게 추출하고 기본값을 제공하는 것도 좋습니다.


196-200: 메서드 시그니처 변경이 적절합니다.

onContentClickisLiked 파라미터를 추가하여 현재 좋아요 상태를 전달할 수 있게 되었습니다.


213-218: 코드 포맷팅 개선이 적절합니다.

여러 줄로 나누어 가독성이 향상되었습니다.


228-228: debounce 시간을 명시적으로 설정한 것이 좋습니다.

100ms로 설정하여 디바운스 지연으로 인한 동기화 문제를 완화하려는 의도가 잘 반영되었습니다.

app/src/main/java/com/into/websoso/ui/feedDetail/FeedDetailActivity.kt (3)

84-84: isLiked 프로퍼티 추가가 적절합니다.

Intent에서 좋아요 상태를 안전하게 읽어오고 기본값을 제공하는 것이 좋습니다.


123-123: debounce 시간 명시적 설정이 일관성 있게 적용되었습니다.

FeedFragment와 동일한 100ms로 설정하여 일관성을 유지했습니다.


465-465: setupView에서 isLiked 전달이 적절합니다.

초기 좋아요 상태를 뷰모델에 올바르게 전달하고 있습니다.

Copy link
Member

@s9hn s9hn left a comment

Choose a reason for hiding this comment

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

코드 보기 힘들었을텐데 고생했어요
추후 리팩터링을 한다면, 좋아요에 대한 정보를 모두 넘겨주는 것보다 피드 id만 넘겨주고 해당 피드의 기존 상태값을 이용해 toggle처럼 상태변경해주는 것도 좋겠군요

@m6z1 m6z1 merged commit 1b409f8 into develop Jul 6, 2025
1 of 2 checks passed
@m6z1 m6z1 deleted the feat/677 branch July 6, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏹 궁사 명지 웹소소 공주의 은밀한 사냥생활 🔨 [FIX] 버그를 수정합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 피드 <-> 피드 상세 간 좋아요 싱크 맞지 않는 이슈

3 participants