Skip to content

Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정 - #481

Merged
dev-domo merged 3 commits into
developfrom
fix/#480-back
Jul 27, 2026
Merged

Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정#481
dev-domo merged 3 commits into
developfrom
fix/#480-back

Conversation

@dev-domo

@dev-domo dev-domo commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

🔗 연결된 이슈

📄 작업 내용

  • 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정
구현 내용 IPhone 16 pro IPhone 13 mini
GIF

✅ Testing

  • 테스트 목적과 상황
    공통 여정 답변 상세보기에서 뒤로 가기 클릭
  • 시나리오 진행에 필요한 조건
    공통 여정 관련 알림을 탭하여 -> 공통 여정 답변 상세보기로 이동한 후 -> 뒤로 가기를 클릭한다.
    홈에서 퀘스트 탭을 클릭하고 -> 공통 여정 탭바를 클릭한 후 -> 공통 여정 답변 상세보기로 이동한 후 -> 뒤로 가기를 클릭한다.
  • 시나리오 완료 시 보장하는 결과
    공통 여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동한다.

💻 주요 코드 설명

ParentQuestViewController

  • 퀘스트 탭에서 <나의 여정> 혹은 <공통 여정> 탭을 누르면 ParentQuestViewController의 bind 메서드가 호출됩니다.
  • bind 메서드에서는 사용자가 클릭한 탭의 인덱스를 인식하여 올바른 탭을 보여줍니다.
  • 이때 bind 메서드에서 selectedIndex를 사용자가 실제로 탭한 인덱스로 초기화하지 않는 것이 문제가 되었습니다.
  • 더불어, 퀘스트 탭에서 다른 탭으로 갔다가 다시 퀘스트 탭으로 돌아왔을 때는 <나의 여정>이 선택되어있어야 합니다.
  • 이에 따라 아래와 같이 코드를 수정했습니다. (주석 참고)
final class ParentQuestViewController<T: QuestTabItem> {

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        
        // 다른 뷰로의 push가 아닌 다른 탭으로 전환한 경우에만 selectedIndex를 0으로 초기화
        if navigationController?.topViewController === self {
            selectedIndex = 0
        }
    }

    private func bind() {
        tabBar.didTap = { [weak self] index in
            guard let self,
                  index >= 0 && index < controllers.count
            else {
                return
            }
            selectedIndex = index    // 사용자가 탭했을 때 selectedIndex 업데이트
            show(controllers[index])
        }
    }
}

Summary by CodeRabbit

  • 버그 수정
    • 퀘스트 탭을 선택하면 선택 상태가 즉시 올바르게 반영됩니다.
    • 화면을 벗어난 후 다시 진입할 때 기본 탭으로 정상 초기화됩니다.

@dev-domo
dev-domo requested review from juri123123 and y-eonee July 26, 2026 16:39
@dev-domo dev-domo self-assigned this Jul 26, 2026
@dev-domo dev-domo added the fix 버그나 오류 해결 label Jul 26, 2026
@dev-domo dev-domo changed the title Fix: #480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정 Fix/#480 공통여정 답변 상세보기에서 뒤로 가기 클릭 시 공통 여정 탭으로 이동하도록 수정 Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e52ae692-5d3b-40f2-8ab7-3ea41508e0e9

📥 Commits

Reviewing files that changed from the base of the PR and between d3594b3 and e1c2d56.

📒 Files selected for processing (1)
  • ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/Quest/ViewController/ParentQuestViewController.swift

Walkthrough

유효한 탭을 클릭하면 selectedIndex가 즉시 갱신됩니다. 화면이 내비게이션 스택의 top인 상태로 사라질 때는 선택 인덱스가 0으로 초기화됩니다.

Changes

탭 선택 상태 동기화

Layer / File(s) Summary
탭 선택 및 화면 이탈 상태 갱신
ByeBoo-iOS/.../ParentQuestViewController.swift
유효한 탭 클릭 시 선택 인덱스를 갱신하고, 화면 이탈 시 내비게이션 스택의 top이면 selectedIndex0으로 초기화합니다.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: y-eonee

Poem

토끼가 탭을 톡 누르면
선택 인덱스 깡충 갱신
떠날 땐 0으로 폴짝
화면 흐름도 산뜻해져
깡총! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 뒤로 가기 시 공통 여정 탭으로 복귀하도록 탭 선택 상태를 갱신하는 변경과 직접적으로 일치합니다.
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.
✨ 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/#480-back

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.

Comment on lines +28 to +45
selectedIndex = 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.

요거 viewDidLoad 뒤로 갈 수 있도록 수정 부탁드립니다 ! 실행 순서대로 함수가 나열되어 있어야 가독성이 올라갈 것 같아요 ㅎㅎ

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.

앗 좋습니다! 수정할게요

@dev-domo
dev-domo merged commit 8a61c80 into develop Jul 27, 2026
2 checks passed
@dev-domo
dev-domo deleted the fix/#480-back branch July 28, 2026 00:55
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] 공통 여정 상세 보기에서 뒤로 가기 클릭 시 나의 여정으로 이동하는 오류 해결

2 participants