Skip to content

[Fix] 카카오 뒤로가기 이슈 해결#133

Merged
kimjw2003 merged 3 commits into
developfrom
fix/#131-kakao-back-press-issue
Jan 18, 2026
Merged

[Fix] 카카오 뒤로가기 이슈 해결#133
kimjw2003 merged 3 commits into
developfrom
fix/#131-kakao-back-press-issue

Conversation

@kimjw2003

@kimjw2003 kimjw2003 commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

📮 관련 이슈

📌 작업 내용

  • event 추가
  • sharedFlow로 변경

Summary by CodeRabbit

릴리스 노트

  • 리팩터링
    • 로그인 흐름을 데이터 기반 상태에서 이벤트 기반 네비게이션으로 전환하여 라우팅 처리를 간소화했습니다.
  • 신규 기능
    • 로그인 성공 후 화면 이동이 이벤트로 발생하도록 개선되어 홈 또는 온보딩으로의 전환이 명확해졌습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@kimjw2003 kimjw2003 self-assigned this Jan 17, 2026
@kimjw2003 kimjw2003 added the Fix 🐛 버그, UI 오류, 오타, 명세와의 불일치 등을 수정 label Jan 17, 2026
@kimjw2003 kimjw2003 requested a review from a team as a code owner January 17, 2026 17:24
@coderabbitai

coderabbitai Bot commented Jan 17, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

로그인 흐름이 상태 기반(VerifyStatusData)에서 이벤트 기반(LoginNavigationEvent) 네비게이션으로 리팩토링되었습니다. LoginViewModel은 SharedFlow로 네비게이션 이벤트를 발행하고 LoginScreen은 이를 수집해 Home 또는 OnBoarding으로 이동합니다.

Changes

Cohort / File(s) 요약
Login UI
app/src/main/java/com/flint/presentation/login/LoginScreen.kt
verifyStatus 수집 제거. LaunchedEffect(Unit)viewModel.navigationEvent 수집 추가; UiState.SuccessNavigateToHome 또는 NavigateToOnBoarding(tempToken)에 따라 네비게이션 디스패치. Kakao 로그인 UI 흐름 유지
ViewModel & Navigation Events
app/src/main/java/com/flint/presentation/login/LoginViewModel.kt, app/src/main/java/com/flint/presentation/login/event/LoginNavigationEvent.kt
PreferencesManager 및 토큰 저장 로직 제거. _verifyStatus(StateFlow) 제거, _navigationEvent(MutableSharedFlow<UiState>) 추가. socialVerifyWithKakao가 로딩/성공/실패 UiState를 방출하며 성공 시 등록 여부에 따라 NavigateToHome 또는 NavigateToOnBoarding(tempToken) 발행. 새로운 LoginNavigationEvent sealed interface 추가

Sequence Diagram(s)

sequenceDiagram
    participant UI as "LoginScreen (UI)"
    participant VM as "LoginViewModel"
    participant Repo as "AuthRepository"
    participant Nav as "Navigator"

    rect rgba(135,206,235,0.5)
    UI->>VM: Kakao 로그인 요청 (socialVerifyWithKakao)
    VM->>Repo: socialVerify request
    Repo-->>VM: response (success: isRegistered?/tempToken)
    end

    rect rgba(144,238,144,0.5)
    VM-->>UI: emit UiState.Success(NavigateToHome) or UiState.Success(NavigateToOnBoarding(tempToken))
    UI->>Nav: Dispatch navigation action (Home or OnBoarding with token)
    Nav-->>UI: Navigate completed
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • [Feat] 카카오 인증 연결 #122: 유사한 로그인/verifyStatus 처리 변경을 다루며 socialVerify 흐름과 네비게이션 결정 로직에 직접적인 코드 수준 연관이 있음.

Suggested reviewers

  • nahy-512

개요

로그인 흐름이 상태 기반 검증에서 이벤트 기반 네비게이션으로 리팩토링되었습니다. LoginViewModel이 PreferencesManager를 제거하고 SharedFlow를 통해 LoginNavigationEvent를 발행하며, LoginScreen이 이벤트를 구독하여 네비게이션을 처리하는 구조로 변경되었습니다.

변경사항

집단 / 파일 요약
UI 상태 관찰 개선
app/src/main/java/com/flint/presentation/login/LoginScreen.kt
verifyStatus 수집을 navigationEvent 수집으로 변경. LaunchedEffect에서 UiState.SuccessLoginNavigationEvent(NavigateToHome 또는 NavigateToOnBoarding)에 따라 네비게이션 액션 디스패치. 직접적인 데이터 기반 라우팅 로직 제거
로그인 흐름 및 의존성 리팩토링
app/src/main/java/com/flint/presentation/login/LoginViewModel.kt, app/src/main/java/com/flint/presentation/login/event/LoginNavigationEvent.kt
PreferencesManager 의존성 제거. _verifyStatus(StateFlow) → _navigationEvent(SharedFlow)로 교체. socialVerifyWithKakao가 등록 여부에 따라 NavigateToHome 또는 NavigateToOnBoarding(tempToken) 이벤트 발행. LoginNavigationEvent sealed interface 추가

예상 코드 리뷰 시간

🎯 3 (보통) | ⏱️ ~20분

관련 가능 PR

  • [Feat] 카카오 인증 연결 #122: 동일한 LoginViewModel 및 LoginScreen의 socialVerify 흐름을 verifyStatus/PreferencesManager 기반에서 이벤트 기반 LoginNavigationEvent로 리팩토링한 PR과 코드 수준 연관 있음.

추천 리뷰어

  • nahy-512

🐰 로그인 길을 폴짝 건너며,
이벤트 한 송이 들고 달려가네.
상태의 굴레는 살짝 벗겨지고,
토큰 한 줌 들고 온보딩 길로,
혹은 집으로 향하는 발걸음 밝네.

🚥 Pre-merge checks | ✅ 2 | ❌ 3
❌ Failed checks (1 warning, 2 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR 설명에서 필수 섹션인 '관련 이슈'와 '작업 내용'이 포함되어 있으나, 작업 내용이 매우 간단하고 스크린샷이나 구체적인 변경사항 설명이 부족합니다. 작업 내용을 더 자세히 작성하고, 변경사항이 문제를 어떻게 해결하는지 설명해 주세요.
Linked Issues check ❓ Inconclusive PR의 코드 변경사항이 #131의 목표인 카카오 로그인 후 뒤로가기 이슈 해결과 직접적으로 연결되는 구체적 설명이 부족하여 불명확합니다. navigationEvent 기반 로직이 뒤로가기 문제를 구체적으로 어떻게 해결하는지 설명해 주세요.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 카카오 뒤로가기 이슈 해결에 관한 것으로, 실제 변경사항인 event 추가와 navigationEvent 흐름 기반 네비게이션 로직으로의 전환과 부분적으로 연관되어 있습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 LoginScreen, LoginViewModel, LoginNavigationEvent에 제한되어 있으며, #131의 카카오 로그인 뒤로가기 이슈 해결 범위 내에 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/src/main/java/com/flint/presentation/login/LoginViewModel.kt`:
- Line 30: Check for null/empty tempToken before emitting NavigateToOnBoarding:
in the LoginViewModel where you call
_navigationEvent.emit(UiState.Success(LoginNavigationEvent.NavigateToOnBoarding(data.tempToken
?: ""))), validate data.tempToken (reference: data.tempToken) and if it is null
or blank emit an error state (e.g., UiState.Error or a dedicated
LoginNavigationEvent.ShowError) instead of substituting an empty string, so the
onboarding/signup flow never receives an invalid empty token.
🧹 Nitpick comments (2)
app/src/main/java/com/flint/presentation/login/LoginScreen.kt (1)

44-60: SharedFlow를 사용한 네비게이션 이벤트 수집 패턴이 적절합니다.

LaunchedEffect(Unit)collect를 사용하여 일회성 네비게이션 이벤트를 처리하는 것은 카카오 뒤로가기 이슈를 해결하기 위한 올바른 접근 방식입니다. SharedFlow는 replay가 없어 중복 네비게이션을 방지합니다.

다만, UiState.Failure 케이스가 무시되고 있어 로그인 실패 시 사용자에게 피드백이 전달되지 않습니다. 에러 핸들링 추가를 고려해 주세요.

💡 에러 핸들링 추가 제안
             when (uiState) {
                 is UiState.Success -> {
                     when(val event = uiState.data) {
                         is LoginNavigationEvent.NavigateToHome -> {
                             navigateToHome()
                         }
                         is LoginNavigationEvent.NavigateToOnBoarding -> {
                             navigateToOnBoarding(event.tempToken)
                         }
                     }
                 }
-                else -> {}
+                is UiState.Failure -> {
+                    // TODO: 로그인 실패 시 사용자에게 에러 메시지 표시
+                    Timber.e("Login failed")
+                }
+                is UiState.Loading -> { /* 로딩 상태 처리 */ }
             }
app/src/main/java/com/flint/presentation/login/LoginViewModel.kt (1)

19-20: SharedFlow 버퍼 설정 확인 필요

MutableSharedFlow의 기본 파라미터(replay=0, extraBufferCapacity=0)를 사용하면, collector가 준비되지 않은 상태에서 emit이 호출될 경우 suspend될 수 있습니다. 네비게이션 이벤트가 유실되지 않도록 extraBufferCapacity를 추가하는 것을 권장합니다.

💡 버퍼 용량 추가 제안
-    private val _navigationEvent = MutableSharedFlow<UiState<LoginNavigationEvent>>()
+    private val _navigationEvent = MutableSharedFlow<UiState<LoginNavigationEvent>>(extraBufferCapacity = 1)

if (data.isRegistered) {
_navigationEvent.emit(UiState.Success(LoginNavigationEvent.NavigateToHome))
} else {
_navigationEvent.emit(UiState.Success(LoginNavigationEvent.NavigateToOnBoarding(data.tempToken ?: "")))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n "tempToken" --type kotlin -C 3

Repository: imflint/Flint-Android

Length of output: 10092


🏁 Script executed:

rg -n "tempToken" --type kotlin app/src/main/java/com/flint/presentation/onboarding/ -C 5

Repository: imflint/Flint-Android

Length of output: 1585


🏁 Script executed:

fd "OnboardingProfileRoute" --type f --extension kt

Repository: imflint/Flint-Android

Length of output: 47


🏁 Script executed:

rg "fun OnboardingProfileRoute|@Composable.*OnboardingProfileRoute" --type kotlin -A 20

Repository: imflint/Flint-Android

Length of output: 2243


🏁 Script executed:

rg "composable<Route.OnboardingProfile>" --type kotlin -A 15

Repository: imflint/Flint-Android

Length of output: 1980


🏁 Script executed:

rg "savedStateHandle|navBackStackEntry" --type kotlin app/src/main/java/com/flint/presentation/onboarding/ -B 2 -A 5 | head -100

Repository: imflint/Flint-Android

Length of output: 47


🏁 Script executed:

fd "OnboardingViewModel\|OnboardingProfileViewModel" --type f --extension kt

Repository: imflint/Flint-Android

Length of output: 47


🏁 Script executed:

rg "tempToken" --type kotlin app/src/main/java/com/flint/presentation/onboarding/ -B 3 -A 3

Repository: imflint/Flint-Android

Length of output: 1044


🏁 Script executed:

rg "SignupRequestModel\|SignupRequestDto" --type kotlin -B 2 -A 8 | head -80

Repository: imflint/Flint-Android

Length of output: 47


🏁 Script executed:

fd "Signup" --type f --extension kt | head -20

Repository: imflint/Flint-Android

Length of output: 328


🏁 Script executed:

rg "SignupRequestModel" --type kotlin app/src/main/java/com/flint/presentation/ -B 2 -A 2

Repository: imflint/Flint-Android

Length of output: 47


🏁 Script executed:

rg "SignupRequestModel" --type kotlin -B 2 -A 2

Repository: imflint/Flint-Android

Length of output: 3583


빈 문자열로의 tempToken 변환 재검토 필요

data.tempToken이 null일 때 빈 문자열("")로 대체하면, 이후 온보딩 화면을 거쳐 회원가입 API 호출 시 빈 tempToken이 그대로 전송됩니다. 로그인 단계에서 tempToken의 존재 여부를 검증하고 null인 경우 적절한 에러 처리를 하는 것이 권장됩니다.

🤖 Prompt for AI Agents
In `@app/src/main/java/com/flint/presentation/login/LoginViewModel.kt` at line 30,
Check for null/empty tempToken before emitting NavigateToOnBoarding: in the
LoginViewModel where you call
_navigationEvent.emit(UiState.Success(LoginNavigationEvent.NavigateToOnBoarding(data.tempToken
?: ""))), validate data.tempToken (reference: data.tempToken) and if it is null
or blank emit an error state (e.g., UiState.Error or a dedicated
LoginNavigationEvent.ShowError) instead of substituting an empty string, so the
onboarding/signup flow never receives an invalid empty token.

Comment on lines 40 to 43
sealed interface LoginNavigationEvent {
data object NavigateToHome : LoginNavigationEvent
data class NavigateToOnBoarding(val tempToken: String) : LoginNavigationEvent
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

p3
NavigationeEvent만 이런 식으로 관리하나요??
스낵바 표시나 에러 다이얼로그 같은 것도 SideEffect로 묶어서 관리해보면 혹시 어떨까 싶어서..!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

해당 화면에 navigation event밖에 없어서 저렇게 구성해두었습니다. 일단 수정 편의성을 높이기 위해 별도의 파일로 이동시키겠습니다

@nahy-512 nahy-512 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다. 네비게이션 코드 SideEffect로 처리하니까 훨씬 마음이 편안하네요잉

@kimjw2003 kimjw2003 merged commit 31b30be into develop Jan 18, 2026
2 checks passed
@kimjw2003 kimjw2003 deleted the fix/#131-kakao-back-press-issue branch January 18, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix 🐛 버그, UI 오류, 오타, 명세와의 불일치 등을 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 카카오 로그인 BackPress 이슈

2 participants