Skip to content

[Feature/#5] 카카오 소셜 로그인 구현#14

Merged
wjdrjs00 merged 6 commits intodevelopfrom
feature/#5-kakao-login
Jun 27, 2025
Merged

[Feature/#5] 카카오 소셜 로그인 구현#14
wjdrjs00 merged 6 commits intodevelopfrom
feature/#5-kakao-login

Conversation

@wjdrjs00
Copy link
Copy Markdown
Member

@wjdrjs00 wjdrjs00 commented Jun 26, 2025

[ PR Content ]

카카오 소셜 로그인을 구현합니다.

Related issue

Screenshot 📸

default.mp4

Work Description

  • 카카오 sdk 연동

To Reviewers 📢

  • 해당 pr에서는 카카오 로그인 로직 부분만 봐주면 감사하겠습니다! (화면 ui와 state등은 뷰가 나오면 바뀔 가능성이 높아 현재 따로 작업하진 않았습니다.)
  • 카카오 로그인은 카카오토큰과 유저정보를 받아오는 부분까지만 구현했습니다!
    이 값들을 통해 회원가입하는 부분은 추후 network 설정과 서버 작업이 완료되는 시점에 고도화 해서 작업하겠습니다..!

필수 확인 사항

  • local.properties에 추가된 속성이 있어 컨플루언스에 공유해두었습니다!

Summary by CodeRabbit

  • New Features

    • 카카오 로그인 기능이 앱에 통합되었습니다. 카카오톡 및 카카오 계정으로 로그인할 수 있습니다.
    • 로그인 화면이 리팩토링되어 카카오 로그인 버튼과 관련 UI가 개선되었습니다.
    • 로그인 상태 및 로그인 프로세스를 관리하는 새로운 ViewModel 구조가 도입되었습니다.
  • 버그 수정

    • 로그인 화면 내 네비게이션 로직이 개선되어 사용자 경험이 향상되었습니다.
  • 기타

    • 카카오 SDK 관련 라이브러리와 의존성이 추가되고, 앱 빌드 설정이 카카오 로그인 지원에 맞게 업데이트되었습니다.
    • 깃허브 워크플로우에 카카오 네이티브 앱 키를 자동으로 설정하는 단계가 추가되었습니다.

wjdrjs00 added 3 commits June 27, 2025 04:18
- 카카오 SDK 의존성 추가
- AndroidManifest.xml에 AuthCodeHandlerActivity 추가
- Application 클래스에서 카카오 SDK 초기화
- 카카오 네이티브 앱 키 gradle.properties에서 관리
- LoginViewModel 추가 및 카카오 로그인 로직 구현
- LoginScreen에 임시 카카오 로그인 UI 및 이벤트 핸들링 추가
@wjdrjs00 wjdrjs00 requested a review from l5x5l June 26, 2025 20:08
@wjdrjs00 wjdrjs00 self-assigned this Jun 26, 2025
@wjdrjs00 wjdrjs00 added ✨ Feature 새로운 기능 구현 🧤 대현 labels Jun 26, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 26, 2025

"""

Walkthrough

카카오 소셜 로그인을 위한 기능이 전반적으로 도입되었습니다. 카카오 SDK가 앱에 연동되고, 로그인 화면과 ViewModel, 인텐트/사이드이펙트/상태 모델이 추가되었습니다. 빌드 설정과 매니페스트가 카카오 인증에 맞게 수정되었으며, 관련 라이브러리와 저장소가 프로젝트에 반영되었습니다.

Changes

파일/경로 그룹 변경 요약
app/build.gradle.kts, gradle/libs.versions.toml, settings.gradle.kts, presentation/build.gradle.kts 카카오 SDK 및 저장소 추가, 빌드 설정에 카카오 앱 키 주입, 관련 의존성 및 저장소 등록
app/src/main/AndroidManifest.xml 카카오 인증용 Activity 및 인텐트 필터 추가, 매니페스트 수정
app/src/main/java/com/threegap/bitnagil/BitnagilApplication.kt Application에서 KakaoSdk 초기화 로직 추가
app/src/main/java/com/threegap/bitnagil/MainNavHost.kt 로그인 네비게이션 진입점을 LoginScreenContainer로 변경
presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt LoginScreen 분리 및 컨테이너화, ViewModel 연동, 카카오 로그인 버튼 및 UI/로직 개선
presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt LoginViewModel 신규 추가, 카카오 로그인 인텐트/사이드이펙트 처리
presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginIntent.kt
presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt
presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt
로그인 인텐트/사이드이펙트/상태 모델 신규 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LoginScreenContainer
    participant LoginViewModel
    participant KakaoSDK
    participant UserApiClient

    User->>LoginScreenContainer: 카카오 로그인 버튼 클릭
    LoginScreenContainer->>LoginViewModel: OnKakaoLoginClick 인텐트 전송
    LoginViewModel->>LoginScreenContainer: (사이드이펙트) RequestKakaoTalkLogin 또는 RequestKakaoAccountLogin
    LoginScreenContainer->>KakaoSDK: loginWithKakaoTalk/loginWithKakaoAccount 호출
    KakaoSDK-->>LoginScreenContainer: OAuthToken, error 반환
    LoginScreenContainer->>LoginViewModel: OnKakaoLoginResult 인텐트 전송
    LoginViewModel->>UserApiClient: me()로 사용자 정보 요청 (성공 시)
    UserApiClient-->>LoginViewModel: 사용자 정보 반환 또는 에러
Loading

Assessment against linked issues

Objective (이슈 번호) Addressed Explanation
카카오 SDK 연동 (#5)
카카오 소셜 로그인 구현 (#5)

Poem

카카오 바람 타고 hoppity-hop,
로그인 버튼에 깡총깡총 점프!
SDK 불러와, 앱 키도 챙기고,
로그인 성공하면 토끼도 웃지요.
빛나길 위에서 만나는 봄,
소셜 로그인 완성, 토끼의 꿈! 🐰✨
"""


📜 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 1ba7b83 and 679e736.

📒 Files selected for processing (1)
  • .github/workflows/develop_branch.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/develop_branch.yml
⏰ Context from checks skipped due to timeout of 90000ms (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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@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: 3

🧹 Nitpick comments (5)
settings.gradle.kts (1)

23-24: 카카오 전용 레포지토리에 scope 제한을 두면 의도치 않은 의존성 충돌을 줄일 수 있습니다
google() 레포지토리에서 사용한 것처럼 content { includeGroup("com.kakao.sdk") } 블록을 추가하면, 해당 레포지토리에서 com.kakao.sdk 그룹만 받아오도록 제한할 수 있습니다. 불필요한 중복 다운로드와 잠재적 충돌을 예방할 수 있으니 적용을 권장드립니다.

-        maven { url = java.net.URI("https://devrepo.kakao.com/nexus/content/groups/public/") }
+        maven {
+            url = java.net.URI("https://devrepo.kakao.com/nexus/content/groups/public/")
+            content {
+                includeGroup("com.kakao.sdk")
+            }
+        }
presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt (1)

6-9: 불필요한 is 접두사로 인한 Kotlin copy() 파라미터 네이밍 이슈
Kotlin 데이터 클래스에서 Boolean 필드에 is 접두사를 사용하면 copy() 시 파라미터명이 isLoggedIn으로 그대로 노출되어 IDE 자동 완성 시 가독성이 약간 떨어집니다. loggedIn 으로 네이밍하면 copy(loggedIn = true) 형태로 자연스러워집니다. 변경을 고려해 주세요.

-data class LoginState(
-    val isLoggedIn: Boolean = false,
-) : MviState
+data class LoginState(
+    val loggedIn: Boolean = false,
+) : MviState
presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt (1)

5-9: data object 대신 object 사용 고려
필드가 없는 singleton인 경우 data object 키워드는 의미적 이점이 거의 없습니다(구조 동등성 비교가 필요 없기 때문). 단순 object 로 선언하면 bytecode 와 직렬화 오버헤드를 약간 줄일 수 있습니다.

-    data object RequestKakaoTalkLogin : LoginSideEffect
-    ...
-    data object RequestKakaoAccountLogin : LoginSideEffect
+    object RequestKakaoTalkLogin : LoginSideEffect
+    ...
+    object RequestKakaoAccountLogin : LoginSideEffect
app/build.gradle.kts (1)

12-25: API 키 설정이 보안 관점에서 적절합니다.

local.properties에서 민감한 API 키를 로드하는 방식이 올바르며, manifestPlaceholders와 buildConfigField 모두 정확히 설정되었습니다.

선택적 개선사항: local.properties 파일이 없거나 키가 누락된 경우에 대한 에러 처리를 추가하는 것을 고려해보세요:

 val properties =
     Properties().apply {
-        load(rootProject.file("local.properties").inputStream())
+        val localPropertiesFile = rootProject.file("local.properties")
+        if (localPropertiesFile.exists()) {
+            load(localPropertiesFile.inputStream())
+        }
     }
+
+val kakaoAppKey = properties["kakao.native.app.key"] as? String
+    ?: throw GradleException("kakao.native.app.key not found in local.properties")
presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt (1)

64-78: 플레이스홀더 UI에 TODO 주석 추가 권장

현재 "빛나길 로고"와 "카카오 로그인버튼"이라는 플레이스홀더 텍스트가 사용되고 있습니다. 나중에 실제 UI 요소로 교체해야 함을 명확히 하기 위해 TODO 주석을 추가하는 것이 좋습니다.

+        // TODO: 실제 로고 이미지로 교체 필요
         Text(
             text = "빛나길 로고",
             modifier = Modifier.align(Alignment.Center),
         )

         Button(
             onClick = onKakaoLoginClick,
             modifier =
                 Modifier
                     .align(Alignment.BottomCenter)
                     .padding(20.dp),
         ) {
+            // TODO: 카카오 로그인 버튼 디자인 적용 필요
             Text(
                 text = "카카오 로그인버튼",
             )
         }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d93680 and 49e6c78.

📒 Files selected for processing (12)
  • app/build.gradle.kts (3 hunks)
  • app/src/main/AndroidManifest.xml (1 hunks)
  • app/src/main/java/com/threegap/bitnagil/BitnagilApplication.kt (1 hunks)
  • app/src/main/java/com/threegap/bitnagil/MainNavHost.kt (2 hunks)
  • gradle/libs.versions.toml (2 hunks)
  • presentation/build.gradle.kts (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt (2 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginIntent.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginSideEffect.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginState.kt (1 hunks)
  • settings.gradle.kts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
app/src/main/java/com/threegap/bitnagil/MainNavHost.kt (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt (1)
  • LoginScreenContainer (23-51)
presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/common/mviviewmodel/MviViewModel.kt (1)
  • sendSideEffect (23-23)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (9)
gradle/libs.versions.toml (1)

53-54: 카카오 SDK 버전 최신 여부 확인 필요
현재 추가된 2.21.4 버전은 24년 4월 릴리즈로, 최근 보안 패치가 포함된 2.22.x 이상이 존재합니다. 출시 시점에 맞춰 한 번 더 버전 확인을 권장드립니다.
또한 Kakao SDK 는 v2-navi · v2-share 등 모듈 간 의존성이 있으니, 추후 확장 시 bundle 정의를 고려해 두면 유지보수가 용이합니다.

Also applies to: 119-120

presentation/build.gradle.kts (1)

16-17: Proguard/R8 설정 누락 여부 점검
kakao-v2-user 의 경우 @Keep 어노테이션이 부족한 API 가 있어 난독화 시 문제를 일으키는 사례가 있습니다. 릴리즈 빌드에서 로그인 실패를 방지하려면 consumer-rules.pro 파일에 Kakao SDK keep 규칙을 추가했는지 확인해 주세요.
예:

-keep class com.kakao.sdk.** { *; }
-keep class okhttp3.internal.publicsuffix.PublicSuffixDatabase
app/src/main/java/com/threegap/bitnagil/BitnagilApplication.kt (1)

4-4: 카카오 SDK 초기화 구현이 올바릅니다.

Application 클래스에서 SDK를 초기화하는 것은 Android 모범 사례를 따르고 있으며, BuildConfig를 통한 API 키 사용도 보안상 적절합니다.

Also applies to: 11-11, 14-16

app/src/main/java/com/threegap/bitnagil/MainNavHost.kt (1)

8-8: 네비게이션 구조 개선이 적절합니다.

LoginScreenContainer를 사용하여 로그인 로직을 컨테이너 내부로 캡슐화한 것은 관심사 분리 측면에서 좋은 설계입니다. ViewModel을 통한 상태 관리로 더 깔끔한 아키텍처가 되었습니다.

Also applies to: 21-21

app/build.gradle.kts (1)

40-40: 카카오 SDK 의존성 추가가 적절합니다.

프레젠테이션 모듈과 일관성 있게 동일한 라이브러리를 사용하고 있습니다.

app/src/main/AndroidManifest.xml (1)

29-42: 카카오 OAuth 활동 설정이 정확합니다.

AuthCodeHandlerActivity의 인텐트 필터 구성이 카카오 SDK 요구사항에 맞게 올바르게 설정되었으며, 매니페스트 플레이스홀더 사용도 build.gradle.kts와 일관성 있게 구현되었습니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/login/model/LoginIntent.kt (1)

6-13: MVI 패턴 구현이 적절합니다.

LoginIntent sealed class가 카카오 로그인 플로우의 사용자 의도를 명확하게 정의하고 있으며, 옵셔널 타입을 적절히 사용하여 성공/실패 케이스를 처리할 수 있도록 설계되었습니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginViewModel.kt (1)

30-37: 카카오 로그인 타입 선택 로직이 적절합니다

카카오톡 앱 사용 가능 여부에 따라 적절한 로그인 방식을 선택하는 로직이 잘 구현되었습니다.

presentation/src/main/java/com/threegap/bitnagil/presentation/login/LoginScreen.kt (1)

23-51: 컨테이너 패턴이 잘 구현되었습니다

UI 로직과 비즈니스 로직을 효과적으로 분리한 좋은 구현입니다. 사이드이펙트 처리와 콜백 관리가 깔끔하게 구성되어 있습니다.

- GitHub Actions 워크플로우에 local.properties 파일 생성 단계 추가
Copy link
Copy Markdown

@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: 0

🔭 Outside diff range comments (1)
.github/workflows/develop_branch.yml (1)

30-38: ✅ 빌드 전에 local.properties를 생성해야 합니다

assembleDebug 작업이 먼저 실행되고, 그 이후에 local.properties 파일을 생성하고 있습니다.
Gradle 빌드 과정에서 kakao.native.app.key 속성을 필요로 한다면 현재 순서로는 해당 값을 읽지 못해 빌드 실패 혹은 런타임 오류가 발생할 수 있습니다.

다음과 같이 Generate local.properties 단계를 Build with Gradle 단계보다 위로 이동하세요.

-      - name: Build with Gradle
-        run: ./gradlew assembleDebug
-
-      - name: Generate local.properties
+      - name: Generate local.properties
         env:
           KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
         run: |
           echo "kakao.native.app.key=$KAKAO_NATIVE_APP_KEY" >> local.properties
+
+      - name: Build with Gradle
+        run: ./gradlew assembleDebug
🧹 Nitpick comments (1)
.github/workflows/develop_branch.yml (1)

36-37: >> 대신 > 사용 고려

>>(append) 연산자를 사용하면 이미 존재하는 local.properties에 같은 키가 중복 기록될 수 있습니다. CI 환경에서 매번 새 파일을 만드는 목적이라면 덮어쓰는 > 연산자가 더 안전하고 의도에 부합합니다.

- echo "kakao.native.app.key=$KAKAO_NATIVE_APP_KEY" >> local.properties
+ echo "kakao.native.app.key=$KAKAO_NATIVE_APP_KEY" > local.properties
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49e6c78 and c52938e.

📒 Files selected for processing (2)
  • .github/workflows/develop_branch.yml (1 hunks)
  • app/build.gradle.kts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/build.gradle.kts

Copy link
Copy Markdown
Contributor

@l5x5l l5x5l left a comment

Choose a reason for hiding this comment

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

문제 없어보입니다! 머지하시죠!

@wjdrjs00 wjdrjs00 merged commit 3e9517f into develop Jun 27, 2025
2 checks passed
@wjdrjs00 wjdrjs00 deleted the feature/#5-kakao-login branch July 6, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 새로운 기능 구현 🧤 대현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 카카오 소셜 로그인 구현

2 participants