[Fix] #542 - /poke/friend 404 에러 처리 #543
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌴 PR 요약
콕찌르기 진입 시 발생하는 에러를 방지하기 위한 분기 처리를 추가했습니다.
🌱 작업한 브랜치
🌱 PR Point
✅ 문제 원인
#533 이슈를 해결하는 과정에서 콕찌르기 진입 시마다, 에러가 발생하는 것을 확인했습니다. 원인은 기존 로직의 잘못된 분기 처리였습니다.
기존 콕찌르기 진입 흐름:
home/poke
)pokeMainVC
로드viewDidLoad
에서 세 가지 API 호출(/poke/friend
)/poke/new
를 호출하여 신규 유저 여부 확인이 흐름에서 신규 유저의 경우, 이미
PokeMainVC
가 메모리에 로드 된 뒤 온보딩으로 화면 전환되기 때문에 친구 데이터가 존재하지 않아 /poke/friend API에서 404에러가 발생하고 있었습니다.※ 스크린샷에서 보이는 API 경로는 다르지만, 발생 시점과 에러 메세지를 보고 /poke/friend 가 원인이라 판단했습니다.
✅ 문제 해결
PokeMainVC
가 메모리에 올라가기 전인 홈 뷰모델에서 /poke/new 로 신규 유저 여부를 판단하고,신규 유저면 → 온보딩,
기존 유저면 → 메인으로 분기되도록 처리했습니다.
✅ 고려 사항
다른 경로로
PokeMainVC
가 호출될 수 있기 때문에, 기존PokeMainViewModel
의 분기 처리 로직은 삭제하지 않았습니다.우선 지금까지 떠올린 경우의 수는 세 가지 입니다.
1️⃣ 홈뷰에서 진입
딥링크를 사용하지 않고
isNewUser
에 따라 분기처리 해줌(해당 이슈에서 수정)2️⃣ 알림으로 진입
PokeNotificationViewController
로 이동푸시알림을 통해 이동한 경우, 딥링크를 사용하기 때문에
pokeMain
을 로드하게 됨3️⃣ 솝마디를 통해 진입
PokeOnboarding 또는 PokeMain으로 진입하지 않음.
이 중에서 2번의 경우를 때문에 기존 로직의 코드를 남겨두었습니다.(#533 이슈를 해결하려면 아직 친구관계가 없는 상황이 필요해 확인하지 못했어요.)
혹시 제가 떠올리지 못한 경우가 있다면 알려주세요!
📌 참고 사항
HomeForMemberViewModel
에서 콕찌르기 분기처리 부분의 코드를 더 깔끔하게 작성할 수 있는 방법이 있을까요?📮 관련 이슈