Skip to content

[FEAT/#6] 카카오 로그인 구현#22

Open
doorimng wants to merge 17 commits into
developfrom
init/#6-kakao_login_setting
Open

[FEAT/#6] 카카오 로그인 구현#22
doorimng wants to merge 17 commits into
developfrom
init/#6-kakao_login_setting

Conversation

@doorimng

@doorimng doorimng commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Related issue 🛠

Work Description ✏️

  • 카카오 Sdk 연결하여 카카오 로그인 기능 구현했습니다. 임시 로그인 버튼 누르면 로그인 가능!
  • 자동 로그인이 되어있어서 잠깐 해제용으로 버튼 만들어뒀는데 신경 안 써두 댑니다..
  • 로그인하고 홈 갔을 때 뒤로가기로 다시 로그인 화면으로 갈 수 없도록 수정했습니다

Screenshot 📸

KakaoTalk_20260702_184831313.mp4

Uncompleted Tasks 😅

  • API 연결
  • 토큰 발급 여부에 따른 시작 화면 내비게이션 설정
  • 웹훅 설정

To Reviewers 📢

  • 로그인 기능을 구현하긴 했는데... 지금 단계에서 더 구현해야되는데 안 된 부분 있으면 말해주세요 🥹
    그리고 로컬 프로퍼티는 노션에 올려두겠습니다!!

  • LOCAL_PROPERTIES vs. local.properties
    로컬 프로퍼티 작성할 때 어떤 표기 선호하시나용...?! (지금은 어퍼케이스임)

Summary by CodeRabbit

요약

  • 새로운 기능
    • 카카오 로그인 연동(Kakao SDK)과 카카오톡/카카오계정 로그인 흐름을 추가했습니다.
    • 로그인 화면에 임시 로그인 및 카카오 연결/해제 테스트 버튼을 추가했습니다.
  • 버그 수정
    • 로그인 후 홈 화면 이동 시 뒤로가기 스택이 정리되도록 개선했습니다.
  • 기타
    • 카카오 인증 딥링크 처리와 로그인 연동 설정을 반영하고, 필요한 권한을 추가했습니다.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cc6196d-f3c9-463b-80f5-d5a08058c362

📥 Commits

Reviewing files that changed from the base of the PR and between 6443c25 and b964893.

📒 Files selected for processing (4)
  • app/consumer/build.gradle.kts
  • app/instructor/build.gradle.kts
  • gradle/libs.versions.toml
  • presentation/auth/src/main/java/com/ssing/presentation/auth/KakaoLoginManager.kt
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/consumer/build.gradle.kts
  • app/instructor/build.gradle.kts
  • presentation/auth/src/main/java/com/ssing/presentation/auth/KakaoLoginManager.kt

📝 Walkthrough

Walkthrough

카카오 로그인 통합을 위해 저장소와 의존성을 추가하고, 각 앱 모듈에서 카카오 키를 빌드 설정과 매니페스트에 주입했습니다. 앱 시작 시 Kakao SDK를 초기화하도록 변경했고, 로그인 매니저·뷰모델·화면을 연결해 로그인 결과를 처리합니다. 홈 이동에는 백스택 정리 옵션이 적용됩니다.

Changes

카카오 로그인 통합

Layer / File(s) Summary
Gradle 의존성 및 저장소 설정
gradle/libs.versions.toml, settings.gradle.kts
Kakao SDK 버전 참조와 kakao-user 의존성을 추가하고, Kakao Nexus Maven 저장소를 등록했습니다.
앱 모듈 빌드 설정 및 매니페스트
app/consumer/build.gradle.kts, app/instructor/build.gradle.kts, app/consumer/src/main/AndroidManifest.xml, app/instructor/src/main/AndroidManifest.xml
local.properties에서 KAKAO_NATIVE_APP_KEY를 읽어 BuildConfig와 manifest placeholders에 주입하고, kakao-user 의존성을 추가했으며, INTERNET 권한, com.kakao.talk 쿼리, AuthCodeHandlerActivity와 OAuth 딥링크 intent-filter를 등록했습니다.
앱 시작 시 Kakao SDK 초기화
app/consumer/src/main/java/com/ssing/consumer/SsingConsumerApp.kt, app/instructor/src/main/java/com/ssing/instructor/SsingInstructorApp.kt
onCreate()에서 initKakaoSdk()를 호출해 BuildConfig.KAKAO_NATIVE_APP_KEYKakaoSdk.init(...)를 수행하도록 했습니다.
KakaoLoginManager 구현 및 로그인 화면 연동
presentation/auth/build.gradle.kts, presentation/auth/src/main/java/com/ssing/presentation/auth/KakaoLoginManager.kt, presentation/auth/src/main/java/com/ssing/presentation/auth/LoginViewModel.kt, presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt
KakaoLoginManager를 추가해 카카오톡/카카오계정 로그인 흐름과 취소·실패 처리를 구현하고 Hilt EntryPoint로 노출했으며, LoginViewModelLoginScreen에 토스트 처리와 로그인/연결 해제 버튼을 연결했습니다.
홈 이동 시 백스택 정리
app/consumer/src/main/java/com/ssing/consumer/ConsumerMainNavHost.kt, app/instructor/src/main/java/com/ssing/instructor/InstructorMainNavHost.kt
navigateToHome에서 clearBackStackNavOptions()를 함께 전달해 홈 화면 이동 시 백스택을 정리하도록 변경했습니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LoginScreen
  participant LoginViewModel
  participant KakaoLoginManager
  participant KakaoSDK

  LoginScreen->>LoginViewModel: onLoginClick(context)
  LoginViewModel->>KakaoLoginManager: login(context)
  KakaoLoginManager->>KakaoSDK: loginWithKakaoTalk / loginWithKakaoAccount
  KakaoSDK-->>KakaoLoginManager: OAuthToken 또는 오류
  KakaoLoginManager-->>LoginViewModel: onResult(Result)
  LoginViewModel-->>LoginScreen: ShowToast / NavigateToHome Effect
Loading

Possibly related PRs

  • TEAM-SSING/SSING-ANDROID#2: ConsumerMainNavHost/InstructorMainNavHostSsingConsumerApp/SsingInstructorApp에 이어지는 같은 로그인·네비게이션 흐름의 연장선입니다.

Suggested labels: 🩷 유빈

Suggested reviewers: doyeon0307, joyrii, apffkxhsls

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 카카오 로그인 구현이라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed Related issue, 작업 내용, Screenshot, 미완료 작업, 리뷰어 코멘트가 모두 포함되어 템플릿을 대부분 충족합니다.
Linked Issues check ✅ Passed 직접 이슈 #6의 카카오 소셜 로그인 구현 요구와 진행 체크리스트를 코드 변경이 충족합니다.
Out of Scope Changes check ✅ Passed 저장소 추가, 의존성, 매니페스트, 네비게이션, 로그인 UI 보강은 모두 카카오 로그인 구현 범위 안입니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 init/#6-kakao_login_setting

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

@doorimng doorimng requested a review from a team July 2, 2026 14:38
@doorimng doorimng self-assigned this Jul 2, 2026
@doorimng doorimng added this to the [Ssing] APPJAM milestone Jul 2, 2026
@doorimng doorimng removed the request for review from a team July 2, 2026 14:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt (2)

57-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

하드코딩된 문자열 사용.

Text("로그인"), Text("임시 로그인 버튼"), Text("카카오 연결 해제") 모두 리터럴 문자열입니다. stringResource()를 사용해 리소스로 분리하는 것이 좋습니다. As per path instructions, "하드코딩 색상·문자열 회피, MaterialTheme/stringResource 사용".

Also applies to: 64-64, 80-80

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt`
at line 57, The LoginScreen composables are using hardcoded Korean text
literals, which should be moved to string resources. Update the Text calls in
LoginScreen to use stringResource() instead of inline strings for the login
title, temporary login button label, and Kakao disconnect label, and add or
reuse the corresponding resource entries so the UI text is centralized and
localizable.

Source: Path instructions


67-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

UI 레이어에서 SDK 직접 호출 (ViewModel 우회).

"카카오 연결 해제" 버튼이 UserApiClient.instance.unlink를 Composable에서 직접 호출합니다. onKakaoClick처럼 ViewModel을 통해 처리하도록 위임하면 계층 분리가 유지되고 테스트도 쉬워집니다. [TEST] 주석과 PR 설명상 임시 버튼임은 인지하고 있으나, 정식 배포 전 제거 또는 ViewModel 경유로 정리하는 것을 권장합니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt`
around lines 67 - 81, “카카오 연결 해제” 버튼이 Composable인 LoginScreen에서
UserApiClient.instance.unlink를 직접 호출하는 UI/SDK 결합 문제입니다. LoginScreen의 버튼 onClick
로직을 제거하고, onKakaoClick처럼 ViewModel의 이벤트/메서드로 위임한 뒤 ViewModel에서 unlink를 처리하도록
옮기세요. 임시 [TEST] 버튼이라면 정식 배포 전에 삭제하거나, 최소한 UI는 상태/이벤트 전달만 하도록 분리해 계층 경계를 유지하세요.
presentation/auth/src/main/java/com/ssing/presentation/auth/LoginViewModel.kt (1)

18-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

불필요한 이중 viewModelScope.launch 중첩.

kakaoLoginManager.login()은 suspend 함수가 아니라 콜백 등록 후 즉시 반환되므로, 바깥쪽 launch는 실질적인 비동기 대기 없이 곧바로 끝납니다. 실제 효과 전송은 콜백 내부의 두 번째 launch에서 일어나므로 바깥 launch는 제거해도 동작이 동일하며 가독성이 좋아집니다.

♻️ 제안 리팩터
     fun onLoginClick(context: Context) {
-        viewModelScope.launch {
-            kakaoLoginManager.login(context) { result ->
-                viewModelScope.launch {
-                    result.onSuccess { token ->
-                        sendEffect(LoginContract.Effect.ShowToast("로그인 되었습니다."))
-                        sendEffect(LoginContract.Effect.NavigateToHome)
-
-                        // TODO: 서버 연결 시 token.accessToken 전달
-                    }.onFailure { error ->
-                        sendEffect(LoginContract.Effect.ShowToast("로그인에 실패했습니다."))
-
-                        // TODO: 실패 처리
-                    }
-                }
-            }
+        kakaoLoginManager.login(context) { result ->
+            viewModelScope.launch {
+                result.onSuccess { token ->
+                    sendEffect(LoginContract.Effect.ShowToast("로그인 되었습니다."))
+                    sendEffect(LoginContract.Effect.NavigateToHome)
+
+                    // TODO: 서버 연결 시 token.accessToken 전달
+                }.onFailure { error ->
+                    sendEffect(LoginContract.Effect.ShowToast("로그인에 실패했습니다."))
+
+                    // TODO: 실패 처리
+                }
+            }
         }
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@presentation/auth/src/main/java/com/ssing/presentation/auth/LoginViewModel.kt`
around lines 18 - 34, `LoginViewModel.onLoginClick` has an unnecessary outer
`viewModelScope.launch` because `kakaoLoginManager.login()` only registers a
callback and returns immediately, while the actual work happens in the inner
launch inside the callback. Remove the outer coroutine wrapper and keep the
effect handling in the callback path so `onLoginClick`,
`kakaoLoginManager.login`, and the `result.onSuccess`/`onFailure` branches stay
functionally the same but with simpler flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/consumer/build.gradle.kts`:
- Around line 8-10: `properties` 로딩 로직이 `local.properties` 부재나
`KAKAO_NATIVE_APP_KEY` 누락을 검증하지 않아 빌드가 조용히 실패할 수 있습니다. `Properties().apply {
load(...) }`를 사용하는 부분에서 파일 존재 여부와 키 존재 여부를 명시적으로 확인하고, 없으면 즉시 의미 있는 예외로 실패하도록
처리하세요. `build.gradle.kts`의 이 로직은 `app/consumer`와 동일 패턴이 있는 `app/instructor`에도
적용해 중복된 검증을 함께 정리하세요.

In `@app/instructor/build.gradle.kts`:
- Around line 9-11: `properties` 초기화에서 local.properties가 없거나
KAKAO_NATIVE_APP_KEY가 누락된 경우를 안전하게 처리하도록 `app/instructor/build.gradle.kts`의
properties 로딩 로직을 보강하세요.
`load(rootProject.file("local.properties").inputStream())`를 수행하기 전에 파일 존재를 확인하고,
키 조회 시에는 `Properties`에서 값을 검증해 null/빈 값이면 명확히 실패하도록 `properties`,
`KAKAO_NATIVE_APP_KEY`, 그리고 해당 값을 사용하는 구성 로직을 함께 수정하세요.

In `@gradle/libs.versions.toml`:
- Line 27: Update the Kakao SDK dependency version to the latest release by
changing the kakao entry in the versions catalog from the current value to
2.24.0. Keep the change limited to the version declaration so any references
that consume kakao through the catalog pick up the new release automatically.

In
`@presentation/auth/src/main/java/com/ssing/presentation/auth/KakaoLoginManager.kt`:
- Around line 30-41: The Kakao account login failure branch in
KakaoLoginManager.loginWithKakaoAccount is logging the wrong error variable.
Update the Timber.e call inside the loginWithKakaoAccount callback to use error2
instead of the outer-scope error, so the logged failure matches the actual Kakao
account login result.

---

Nitpick comments:
In `@presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt`:
- Line 57: The LoginScreen composables are using hardcoded Korean text literals,
which should be moved to string resources. Update the Text calls in LoginScreen
to use stringResource() instead of inline strings for the login title, temporary
login button label, and Kakao disconnect label, and add or reuse the
corresponding resource entries so the UI text is centralized and localizable.
- Around line 67-81: “카카오 연결 해제” 버튼이 Composable인 LoginScreen에서
UserApiClient.instance.unlink를 직접 호출하는 UI/SDK 결합 문제입니다. LoginScreen의 버튼 onClick
로직을 제거하고, onKakaoClick처럼 ViewModel의 이벤트/메서드로 위임한 뒤 ViewModel에서 unlink를 처리하도록
옮기세요. 임시 [TEST] 버튼이라면 정식 배포 전에 삭제하거나, 최소한 UI는 상태/이벤트 전달만 하도록 분리해 계층 경계를 유지하세요.

In
`@presentation/auth/src/main/java/com/ssing/presentation/auth/LoginViewModel.kt`:
- Around line 18-34: `LoginViewModel.onLoginClick` has an unnecessary outer
`viewModelScope.launch` because `kakaoLoginManager.login()` only registers a
callback and returns immediately, while the actual work happens in the inner
launch inside the callback. Remove the outer coroutine wrapper and keep the
effect handling in the callback path so `onLoginClick`,
`kakaoLoginManager.login`, and the `result.onSuccess`/`onFailure` branches stay
functionally the same but with simpler flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1745a25a-9b60-47de-a0d6-6d5f5cd1760c

📥 Commits

Reviewing files that changed from the base of the PR and between cf9d108 and 6443c25.

📒 Files selected for processing (14)
  • app/consumer/build.gradle.kts
  • app/consumer/src/main/AndroidManifest.xml
  • app/consumer/src/main/java/com/ssing/consumer/ConsumerMainNavHost.kt
  • app/consumer/src/main/java/com/ssing/consumer/SsingConsumerApp.kt
  • app/instructor/build.gradle.kts
  • app/instructor/src/main/AndroidManifest.xml
  • app/instructor/src/main/java/com/ssing/instructor/InstructorMainNavHost.kt
  • app/instructor/src/main/java/com/ssing/instructor/SsingInstructorApp.kt
  • gradle/libs.versions.toml
  • presentation/auth/build.gradle.kts
  • presentation/auth/src/main/java/com/ssing/presentation/auth/KakaoLoginManager.kt
  • presentation/auth/src/main/java/com/ssing/presentation/auth/LoginScreen.kt
  • presentation/auth/src/main/java/com/ssing/presentation/auth/LoginViewModel.kt
  • settings.gradle.kts

Comment thread app/consumer/build.gradle.kts Outdated
Comment thread app/instructor/build.gradle.kts Outdated
Comment thread gradle/libs.versions.toml Outdated

@doyeon0307 doyeon0307 left a comment

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.

고생 많았아!! 멀티모듈 구조에 의존성 넣는게 복잡했을텐데 넘 잘한당
이해 안되는 거 있으면 언제든 질문 고고

Image

이렇게 카카오 열고 토큰 받아오는 것 까지만 하면 되는 거 맞습니다!!
로컬 프로퍼티는 이미 BASE_URL < UPPER_SNAKE_CASE로 설정된 것들이 있어서 유지하면 될 것 같네요!! 지금 설정 좋아용

when (effect) {
is LoginContract.Effect.NavigateToHome -> navigateToHome()
is LoginContract.Effect.ShowToast -> {}
is LoginContract.Effect.ShowToast -> Toast.makeText(context, effect.message, Toast.LENGTH_SHORT).show()

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.

p2 : Context 확장함수 있어요! 사용하면 더 편합니당

Suggested change
is LoginContract.Effect.ShowToast -> Toast.makeText(context, effect.message, Toast.LENGTH_SHORT).show()
is LoginContract.Effect.ShowToast -> context.toast(effect.message)

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.

와 코드가 엄청 쭐었다!! 이런게 있다니 호오
바로 반영해씁니다! 🫶🫶

) {

fun onLoginClick() {
fun onLoginClick(context: Context) {

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.

p2 : 이 메소드명은 kakaoLogin()이 되어야하지 않을까용?

) {

fun onLoginClick() {
fun onLoginClick(context: Context) {

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.

p1 : 안돼~~ 뷰모델이 context를 참조하면 메모리 누수가 발생할 수 있어요.
버튼 클릭으로 카카오 로그인 런처가 열리는 건 일회성 이벤트로 볼 수 있기 때문에 UiEffect를 활용할 수 있습니다.

코드 1

코드 2

참고해서 뷰모델 context 참조 없이 구현되게 고민해보자요!!

Comment on lines +28 to +31
navigateToHome = { navController.navigate(
ConsumerHome,
navController.clearBackStackNavOptions(),
) },

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.

p2 : 자동정렬 쓰고 잇나욤~? 윈도우 기준 ctrl + alt + l 단축키
그리고 파라미터 둘 이상일 때는 named로 써줍시다!

Suggested change
navigateToHome = { navController.navigate(
ConsumerHome,
navController.clearBackStackNavOptions(),
) },
navigateToHome = {
navController.navigate(
route = ConsumerHome,
navOptions = navController.clearBackStackNavOptions(),
)
},

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.

반영해써용 감사합니다 👍💯💯

Comment on lines +27 to +30
navigateToHome = { navController.navigate(
InstructorHome,
navController.clearBackStackNavOptions(),
) },

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.

p2 : 여기도 정렬이랑 named 파라미터 신경 써주세용!!


@EntryPoint
@InstallIn(ActivityComponent::class)
interface KakaoLoginEntryPoint {

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.

p1 : 이거 미사용 되고 있네요!! Screen에서 Activity로 열어줘야할 거예요 이것도 예시코드에 있으니까 참고!!

versionName = "1.0"

val kakaoNativeAppKey = properties.getProperty("KAKAO_NATIVE_APP_KEY").orEmpty()
require(kakaoNativeAppKey.isNotBlank()) {

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.

p3 : 섬세하다

@doorimng doorimng Jul 2, 2026

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.

이거 코드래빗 말 듣고 local properties가 없을 경우 처리한건데 CI에 local properties가 없어서 통과가 안된다요,... 이거 어떻게 해야할까요 ,..🥹🥹

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.

엇 이거 깃헙에서 빌드할 때 secrets에서 local.properties 만들어주는거 아닌가..?? 유빈언니가 넣어줘야하남..???

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.

아아 다시 봤는데 local.properties는 있는데 안에 네이티브키가 안 들어있어서 그런 거 같은디... 유빈언니한테 한 번 물어볼께용

@doorimng doorimng requested a review from a team July 2, 2026 15:46

@joyrii joyrii left a comment

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.

어려웠을 것 같은데 넘 고생 많았어요 ㅠㅠ 일단 나라면 이렇게 못했을 것 같다... 짱짱!!

Image

Timber.i("🍫 카카오 계정 로그인 성공")
onResult(Result.success(token2))
} else {
Timber.e(error2, "🍫 카카오계정 로그인 실패")

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.

p3: 카카오라 초콜릿 ...🍫🍫? 귀여워서 바닥 부셨어요

Comment on lines +21 to +24
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
Timber.d("🍫 카카오톡 로그인 취소")
return@loginWithKakaoTalk
}

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.

p3: 로그인 취소가 되었을 때에는 result 반환을 안 해도 괜찮은지 궁금해요!

Comment on lines +18 to +20
private fun initKakaoSdk() {
KakaoSdk.init(this, BuildConfig.KAKAO_NATIVE_APP_KEY)
}

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.

p3: 앱이 두 개라 따로 설정해줘야 하는군요... 어렵따 엄청 헷갈렸겠는데!!

@oilbeaneda oilbeaneda 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.

예리미 너무너무 고생많앗다 너무 잘하고 너무 멋져 !!!!!!! 늘 많이 배우고 열심히 하는 모습 저두 많이 배워요 ❤️

Image

Comment on lines +21 to +23
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
Timber.d("🍫 카카오톡 로그인 취소")
return@loginWithKakaoTalk

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.

Suggested change
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
Timber.d("🍫 카카오톡 로그인 취소")
return@loginWithKakaoTalk
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
Timber.d("🍫 카카오톡 로그인 취소")
onResult(Result.failure(error))
return@loginWithKakaoTalk
}

p1: 사용자가 로그인을 취소할 경우 onResult 콜백을 호출하지 않고 return 하고 있어서 취소 시에도 실패 결과를 넘겨주면 좋을 것 같아요 ㅎㅎ

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.

엇 단순 사용자 취소면 오류없이 조용히 넘어가는 편이 좋지 않을까요??

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.

호오 그르네요 취소했을 때는 실패한게 아닌데 실패라고 뜨면 안되겟네!!!!!!1 취소했을 때도 onResult 불려서 사용자 취소라고 구분해주면 좋을 것 같다고 생각했는데 여기서는 의미 없띠니 쓰루하장 ㅎㅎ

import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import jakarta.inject.Inject

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.

p1:

Suggested change
import jakarta.inject.Inject
import javax.inject

로 써주세용
이유는 javax. 는 오랫동안 사용되어 온 자바 표준 DI 패키지인데 ilt 공식 문서나 예제 코드에서도 아직은 javax.inject를 기본으로 사용하는 경우가 훨씬 많아요 글구 다른파일들은 다 javax 임! ㅎㅎ

import jakarta.inject.Inject
import timber.log.Timber

class KakaoLoginManager @Inject constructor() {

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.

p2:internal붙여주는 거 어때요 ㅎㅎ


@EntryPoint
@InstallIn(ActivityComponent::class)
interface KakaoLoginEntryPoint {

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.

p2 : 여기두 internal ㅎㅎ

Comment on lines 19 to +24
viewModelScope.launch {
sendEffect(LoginContract.Effect.NavigateToHome)
kakaoLoginManager.login(context) { result ->
viewModelScope.launch {
result.onSuccess { token ->
sendEffect(LoginContract.Effect.ShowToast("로그인 되었습니다."))
sendEffect(LoginContract.Effect.NavigateToHome)

@oilbeaneda oilbeaneda Jul 3, 2026

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.

p2:
viewModelScope.launch { kakaoLoginManager.login(context) { result -> result.onSuccess { token -> sendEffect(LoginContract.Effect.ShowToast("로그인 되었습니다.")) sendEffect(LoginContract.Effect.NavigateToHome)
이렇게 한번에 적어줄 수 있을 것 같은데 viewModelScope.launch 를 두 번 감싼 이유가 있을까용?

internal class LoginViewModel @Inject constructor(
private val kakaoLoginManager: KakaoLoginManager,
) :
BaseViewModel<LoginContract.State, LoginContract.Effect>(

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.

p1: BaseViewModel 내부에 sendEffect가 이미 viewModelScope를 내장하고 있습니다.
LoginViewModel에서 중복로 viewModelScope.launch를 감싸지 않도록 수정해보자요 ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Init] 카카오 로그인 세팅

4 participants