Skip to content

Conversation

@s9hn
Copy link
Member

@s9hn s9hn commented Oct 10, 2025

📌𝘐𝘴𝘴𝘶𝘦𝘴

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

  • 보관함에서 서재로 이동 시, 백스택 쌓이는 문제 해결

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

Summary by CodeRabbit

  • 리팩터링
    • 마이페이지 상단바 및 보관함에서 라이브러리 이동 흐름을 개선했습니다. 액티비티 재시작 없이 현재 화면에서 즉시 전환되어 전환 속도와 부드러움이 향상되며 화면 깜빡임·지연이 줄어들고 상태 유지가 더 안정적입니다. 뒤로 가기 동작도 보다 일관된 탐색을 제공합니다.

@s9hn s9hn self-assigned this Oct 10, 2025
@s9hn s9hn added ♻️ [REFACTOR] 기존 코드를 리팩토링합니다. ⚖️ 재상 세훈 전지적 세훈 시점 🔨 [FIX] 버그를 수정합니다. labels Oct 10, 2025
@s9hn s9hn changed the title refactor: 보관함 -> 서재 -> 뒤로가기 시 바로 앱 종료되도록 수정 fix: My -> 내서재 이동 시 백스택 쌓이는 버그 Oct 10, 2025
@github-actions github-actions bot requested a review from m6z1 October 10, 2025 08:19
@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

MyLibraryFragment에서 MainActivity를 시작하던 내서재 이동을 FragmentResult로 바꾸고, MainActivity는 "NAVIGATE_TO_LIBRARY_FRAGMENT" 결과를 수신해 LIBRARY로 전환하도록 리스너를 추가했습니다. MyLibraryFragment의 기존 navigateToLibraryFragment()와 MainActivity import가 제거되었습니다.

Changes

Cohort / File(s) Summary
FragmentResult 기반 네비게이션 변경
app/src/main/java/com/into/websoso/ui/main/MainActivity.kt, app/src/main/java/com/into/websoso/ui/main/myPage/myLibrary/MyLibraryFragment.kt
- MainActivity: onCreate에 "NAVIGATE_TO_LIBRARY_FRAGMENT" FragmentResultListener 추가하여 수신 시 LIBRARY로 전환 호출
- MyLibraryFragment: MainActivity를 시작하던 코드 대신 setFragmentResult("NAVIGATE_TO_LIBRARY_FRAGMENT", Bundle.EMPTY) 호출로 변경; navigateToLibraryFragment() 메서드 및 MainActivity import 제거

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant MLF as MyLibraryFragment
    participant FM as FragmentManager
    participant MA as MainActivity
    participant Tabs as TabController/LIBRARY

    MLF->>FM: setFragmentResult("NAVIGATE_TO_LIBRARY_FRAGMENT", Bundle.EMPTY)
    Note right of FM: FragmentResult 브로드캐스트
    MA->>MA: FragmentResultListener 수신
    MA->>Tabs: replaceCurrentFragment(LIBRARY)
    Note over MA, Tabs: 탭 전환(백스택 추가 없음)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

깡총깡총, 결과를 띡 보냈지요—훌쩍!
액티비티 깨우지 않고 도서관으로 쓩—
백스택은 쌓이지 않고, 흐름은 말쑥—
토끼가 호출해요, "NAVIGATE_TO_LIBRARY_FRAGMENT"! 🐇📚

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title Check ✅ Passed PR 제목이 변경 내용의 핵심인 “보관함에서 내서재로 이동 시 백스택 누적 버그 수정”을 명확히 요약하고 있어 변경 사항과 완벽히 일치합니다.
Linked Issues Check ✅ Passed 변경된 코드는 프래그먼트 결과 리스너를 이용해 보관함에서 내서재로 전환 시 새로운 액티비티를 시작하지 않고 백스택 누적을 방지하여 이슈 #759의 요구사항을 충족합니다.
Out of Scope Changes Check ✅ Passed PR에서 수행된 네비게이션 로직 수정 외에는 다른 모듈이나 기능에 영향을 미치는 변경 사항이 없으므로 범위를 벗어난 수정은 없습니다.
Description Check ✅ Passed PR 설명은 이슈 번호, 작업 설명, 리뷰어 안내 섹션을 포함하여 템플릿 구조를 대부분 충족하며 백스택 누적 문제 해결 의도가 명확히 기술되어 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/759

📜 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 fc99c85 and 611f2ed.

📒 Files selected for processing (1)
  • app/src/main/java/com/into/websoso/ui/main/MainActivity.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/main/java/com/into/websoso/ui/main/MainActivity.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

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 and usage tips.

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: 1

🧹 Nitpick comments (3)
app/src/main/java/com/into/websoso/ui/main/MainActivity.kt (1)

61-66: 프래그먼트 결과 기반 네비게이션이 올바르게 구현되었습니다.

백스택 문제를 해결하기 위해 Activity 시작 대신 Fragment Result API를 사용하는 것은 좋은 접근입니다. 그러나 "NAVIGATE_TO_LIBRARY_FRAGMENT" 문자열을 companion object에 상수로 추출하여 두 파일에서 재사용하는 것을 권장합니다.

다음 diff를 적용하여 매직 스트링을 상수로 추출하세요:

     companion object {
         private const val DESTINATION_KEY = "destination"
         const val IS_LOGIN_KEY = "isLogin"
+        const val NAVIGATE_TO_LIBRARY_KEY = "NAVIGATE_TO_LIBRARY_FRAGMENT"

         fun getIntent(context: Context): Intent =

그리고 listener 설정 부분을 업데이트하세요:

         supportFragmentManager.setFragmentResultListener(
-            "NAVIGATE_TO_LIBRARY_FRAGMENT",
+            NAVIGATE_TO_LIBRARY_KEY,
             this,
         ) { _, _ ->
             handleNavigation(LIBRARY)
         }
app/src/main/java/com/into/websoso/ui/main/myPage/myLibrary/MyLibraryFragment.kt (2)

198-202: 프래그먼트 결과 네비게이션으로의 전환이 올바릅니다.

Activity 시작 대신 setFragmentResult를 사용하는 것은 백스택 문제를 해결하는 올바른 접근입니다. 그러나 MainActivity에 정의된 상수를 사용하여 매직 스트링을 제거하는 것을 권장합니다.

MainActivity에서 상수를 정의한 후(이전 리뷰 코멘트 참조), 다음과 같이 사용하세요:

         binding.clMyLibraryTopBar.setOnClickListener {
             singleEventHandler.throttleFirst {
-                requireActivity().supportFragmentManager.setFragmentResult("NAVIGATE_TO_LIBRARY_FRAGMENT", Bundle.EMPTY)
+                requireActivity().supportFragmentManager.setFragmentResult(MainActivity.NAVIGATE_TO_LIBRARY_KEY, Bundle.EMPTY)
             }
         }

204-209: 동일한 네비게이션 로직이 일관되게 적용되었습니다.

스토리지 버튼 클릭 핸들러도 프래그먼트 결과 네비게이션을 올바르게 사용합니다. 이전 코멘트와 동일하게 매직 스트링을 상수로 대체하세요.

         binding.llMyLibraryStorage.setOnClickListener {
             singleEventHandler.throttleFirst {
-                requireActivity().supportFragmentManager.setFragmentResult("NAVIGATE_TO_LIBRARY_FRAGMENT", Bundle.EMPTY)
+                requireActivity().supportFragmentManager.setFragmentResult(MainActivity.NAVIGATE_TO_LIBRARY_KEY, Bundle.EMPTY)
             }
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 786c1a8 and fc99c85.

📒 Files selected for processing (2)
  • app/src/main/java/com/into/websoso/ui/main/MainActivity.kt (3 hunks)
  • app/src/main/java/com/into/websoso/ui/main/myPage/myLibrary/MyLibraryFragment.kt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

@m6z1 m6z1 merged commit a9f5eaf into develop Oct 31, 2025
2 checks passed
@m6z1 m6z1 deleted the feat/759 branch October 31, 2025 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

♻️ [REFACTOR] 기존 코드를 리팩토링합니다. ⚖️ 재상 세훈 전지적 세훈 시점 🔨 [FIX] 버그를 수정합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: My -> 내서재 이동 시 백스택 쌓이는 버그

3 participants