Skip to content

feat: 네트워크 모듈 추가 및 구현 #12

Merged
easyhooon merged 5 commits intodevelopfrom
BOOK-46-feature/#5
Jun 21, 2025
Merged

feat: 네트워크 모듈 추가 및 구현 #12
easyhooon merged 5 commits intodevelopfrom
BOOK-46-feature/#5

Conversation

@easyhooon
Copy link
Copy Markdown
Contributor

@easyhooon easyhooon commented Jun 21, 2025

🔗 관련 이슈

📙 작업 설명

  • core:network 모듈 추가
  • Logger 적용
  • Retrofit Convention Plugin 추가
  • API 통신 환경 구축

🧪 테스트 내역 (선택)

  • 주요 기능 정상 동작 확인
  • 브라우저/기기에서 동작 확인
  • 엣지 케이스 테스트 완료
  • 기존 기능 영향 없음

📸 스크린샷 또는 시연 영상 (선택)

기능 미리보기
Logger 테스트

💬 추가 설명 or 리뷰 포인트 (선택)

  • Json 형식도 prettyPrint가 가능한데, 현재 테스트 해볼순 없어서, API 호출 가능한 시점에 적용해보겠습니다~
  • SERVER_BASE_URL은 민감 정보라 git 추적에서 제외하여, 직접 값을 추가하여야 합니다

Summary by CodeRabbit

  • 신규 기능

    • 네트워크 모듈(core:network) 추가 및 서버 헬스 체크 API 연동 기능 도입.
    • Retrofit, OkHttp, Kotlinx Serialization 기반 네트워크 통신 환경 구축.
    • Hilt를 통한 네트워크 의존성 주입 지원.
    • HealthCheckResponse 데이터 클래스 및 BooketService 인터페이스 제공.
    • Android용 Retrofit 설정을 위한 신규 Gradle 플러그인 추가.
    • 디버그 빌드에서만 활성화되는 로깅 초기화 기능 도입.
  • 버그 수정

    • 해당 없음.
  • 문서화

    • core/network 디렉터리에 .gitignore 추가.
  • 기타

    • 메인 액티비티에서 로그 출력 추가.
    • Gradle 플러그인 및 라이브러리 명칭 일관성 개선 및 신규 플러그인 추가.
    • 프로젝트에 core:network 모듈 포함.

@easyhooon easyhooon requested a review from seoyoon513 June 21, 2025 12:17
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 21, 2025

"""

Walkthrough

이번 변경에서는 API 호출을 위한 네트워크 모듈(core:network)이 신규로 추가되고, Retrofit 기반의 네트워크 환경이 구축되었습니다. 네트워크 모듈의 DI, 서비스 인터페이스, 응답 데이터 클래스 등이 구현되었으며, 관련 Gradle 설정과 플러그인, 의존성 관리가 반영되었습니다.

Changes

파일/그룹 변경 요약
core/network/.gitignore /build 디렉토리 무시 설정 추가
core/network/build.gradle.kts 네트워크 모듈용 Gradle 스크립트 및 서버 URL 환경설정 추가
core/network/src/main/kotlin/.../NetworkModule.kt, BooketService.kt, HealthCheckResponse.kt 네트워크 DI 모듈, 서비스 인터페이스, 응답 데이터 클래스 추가
build-logic/build.gradle.kts, build-logic/src/main/kotlin/AndroidRetrofitConventionPlugin.kt Retrofit 플러그인 및 플러그인 매핑 추가/수정
gradle/libs.versions.toml Retrofit, OkHttp, 플러그인 의존성 명칭 정비 및 신규 플러그인 추가
app/src/main/AndroidManifest.xml, app/src/main/kotlin/com/ninecraft/booket/initializer/LoggerInitializer.kt Logger 초기화 Provider 및 Initializer 클래스 추가
feature/main/build.gradle.kts, feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/MainActivity.kt Logger 의존성 및 로그 출력 코드 추가
settings.gradle.kts :core:network 모듈 프로젝트에 포함

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant Hilt/DI
    participant NetworkModule
    participant Retrofit
    participant BooketService
    participant Server

    App->>Hilt/DI: 의존성 주입 요청
    Hilt/DI->>NetworkModule: 네트워크 관련 객체 제공
    NetworkModule->>Retrofit: Retrofit 인스턴스 생성 (BaseUrl, OkHttp, Converter)
    NetworkModule->>BooketService: BooketService 구현체 생성
    App->>BooketService: checkServerHealth() 호출
    BooketService->>Server: GET /health
    Server-->>BooketService: HealthCheckResponse 반환
    BooketService-->>App: HealthCheckResponse 반환
Loading

Assessment against linked issues

Objective Addressed Explanation
core:network 모듈 추가 (#5)
Retrofit 기반 API 호출 환경 구축 (#5)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
LoggerInitializer 및 Logger Provider 추가 (app/src/main/AndroidManifest.xml, app/src/main/kotlin/com/ninecraft/booket/initializer/LoggerInitializer.kt) 네트워크 모듈 설계 및 Retrofit 환경 구축과 직접적인 관련이 없음. 로깅 환경 구축은 명시적 요구사항에 포함되어 있지 않음.
feature/main 모듈에 Logger 의존성 및 로그 코드 추가 (feature/main/build.gradle.kts, feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/MainActivity.kt) 네트워크 모듈 구현과 무관한 기능으로, 요구사항 범위를 벗어남.

Poem

🐇
네트워크 길을 새로 열었지,
Retrofit 타고 서버에 닿았지!
DI와 Hilt가 손을 잡고,
건강 체크 응답이 반갑게 오네.
로그 토끼도 깡총깡총,
코드밭에 평화가 깃들었네.
🥕✨
"""


📜 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 e8e6961 and 9b96dd3.

📒 Files selected for processing (1)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/di/NetworkModule.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/di/NetworkModule.kt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-build
✨ Finishing Touches
  • 📝 Generate Docstrings

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: 1

🧹 Nitpick comments (3)
feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/MainActivity.kt (1)

14-14: 로거 import 위치 및 그룹핑 검토
import com.orhanobut.logger.Logger가 다른 의존성과 잘 어우러지는지, 프로젝트의 import 정렬 정책에 부합하는지 확인이 필요합니다.

core/network/src/main/kotlin/com/ninecraft/booket/core/network/service/BooketService.kt (1)

6-9: 서비스 인터페이스가 깔끔하게 구현되었습니다.

헬스 체크 엔드포인트를 위한 suspend 함수 사용이 적절하며, Retrofit 어노테이션도 올바르게 설정되어 있습니다.

향후 확장을 고려하여 다음과 같은 개선사항을 제안드립니다:

interface BooketService {
+   /**
+    * 서버 상태를 확인합니다.
+    * @return 서버 헬스 체크 응답
+    */
    @GET("health")
    suspend fun checkServerHealth(): HealthCheckResponse
}
core/network/build.gradle.kts (1)

36-38: 속성 읽기 함수에 에러 처리 추가를 권장합니다.

현재 구현은 깔끔하지만, 속성이 존재하지 않을 경우의 처리가 필요할 수 있습니다.

다음과 같이 개선할 수 있습니다:

fun getServerBaseUrl(propertyKey: String): String {
-   return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
+   return gradleLocalProperties(rootDir, providers).getProperty(propertyKey)
+       ?: throw GradleException("Property '$propertyKey' not found in gradle.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 a31a708 and e8e6961.

📒 Files selected for processing (13)
  • app/src/main/AndroidManifest.xml (1 hunks)
  • app/src/main/kotlin/com/ninecraft/booket/initializer/LoggerInitializer.kt (1 hunks)
  • build-logic/build.gradle.kts (1 hunks)
  • build-logic/src/main/kotlin/AndroidRetrofitConventionPlugin.kt (1 hunks)
  • core/network/.gitignore (1 hunks)
  • core/network/build.gradle.kts (1 hunks)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/di/NetworkModule.kt (1 hunks)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/HealthCheckResponse.kt (1 hunks)
  • core/network/src/main/kotlin/com/ninecraft/booket/core/network/service/BooketService.kt (1 hunks)
  • feature/main/build.gradle.kts (1 hunks)
  • feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/MainActivity.kt (2 hunks)
  • gradle/libs.versions.toml (2 hunks)
  • settings.gradle.kts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-build
🔇 Additional comments (15)
core/network/.gitignore (1)

1-1: 빌드 산출물 디렉토리 무시
.gitignorecore/network/build를 무시하도록 추가해 모듈의 빌드 아티팩트를 관리에서 제외한 점이 적절합니다.

feature/main/build.gradle.kts (1)

26-28: 로거 의존성 추가 확인
libs.logger를 feature/main 모듈에 추가해 로깅 프레임워크를 통합한 것은 의도한 바와 부합합니다.

settings.gradle.kts (1)

26-28: core:network 모듈 등록
:core:network를 settings.gradle.kts에 포함시켜 멀티 모듈 빌드에 등록한 점이 올바릅니다.

feature/main/src/main/kotlin/com/ninecraft/booket/feature/main/MainActivity.kt (1)

33-34: 초기화 검증 요청
Logger.d("MainActivity onCreate()") 호출이 의도대로 작동하려면 LoggerInitializer가 AndroidManifest.xml에 제대로 등록돼 있어야 합니다.

#!/bin/bash
# LoggerInitializer 등록 여부 확인
grep -R "LoggerInitializer" -n app/src/main/AndroidManifest.xml
core/network/src/main/kotlin/com/ninecraft/booket/core/network/response/HealthCheckResponse.kt (1)

6-10: 직렬화 데이터 클래스 구현 적절
HealthCheckResponse@Serializable@SerialName("status")를 적용해 서버 응답 매핑을 명확히 한 점이 적절합니다.

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

17-27: AndroidX Startup 통합이 올바르게 구현되었습니다.

LoggerInitializer의 자동 초기화를 위한 provider 설정이 적절하게 구성되어 있습니다. tools:node="merge" 속성을 사용하여 기존 provider와의 충돌을 방지하는 것도 좋은 관례입니다.

build-logic/build.gradle.kts (1)

23-25: 플러그인 매핑이 일관성 있게 개선되었습니다.

도트 표기법으로 변경된 네이밍 컨벤션과 새로운 android.retrofit 플러그인 추가가 적절하게 구성되어 있습니다.

core/network/build.gradle.kts (2)

6-10: 플러그인 구성이 모듈 목적에 맞게 적절히 설정되었습니다.

Android 라이브러리, Retrofit, Hilt 플러그인의 조합이 네트워크 모듈에 적합합니다.


19-27: BuildConfig를 통한 서버 URL 관리가 잘 구현되었습니다.

디버그와 릴리스 빌드 타입별로 서로 다른 서버 URL을 설정하는 방식이 유연하고 보안적으로 안전합니다.

build-logic/src/main/kotlin/AndroidRetrofitConventionPlugin.kt (1)

13-35: Retrofit Convention Plugin이 훌륭하게 구현되었습니다.

플러그인 구조가 명확하고, 필요한 의존성들이 적절히 구성되어 있습니다. Convention 패키지의 유틸리티 함수들을 활용하여 코드 재사용성과 일관성을 높인 점이 우수합니다.

gradle/libs.versions.toml (1)

86-88: 의존성 이름 변경 및 새 플러그인 추가가 적절합니다.

Retrofit 관련 의존성들의 이름이 더 명확하고 일관성 있게 변경되었으며, 새로운 booket-android-retrofit 플러그인 추가로 네트워크 모듈 설정을 체계화했습니다.

Also applies to: 131-131

app/src/main/kotlin/com/ninecraft/booket/initializer/LoggerInitializer.kt (1)

9-21: 로거 초기화 구현이 올바르게 되어 있습니다.

androidx.startup.Initializer를 사용한 로거 초기화가 적절하며, 디버그 빌드에서만 로깅을 활성화하는 것은 좋은 관례입니다. AndroidLogAdapter의 커스텀 isLoggable 구현으로 프로덕션에서 로그 출력을 방지하고 있습니다.

core/network/src/main/kotlin/com/ninecraft/booket/core/network/di/NetworkModule.kt (3)

22-29: JSON 직렬화 설정이 적절합니다.

prettyPrint 활성화로 디버깅이 용이하고, ignoreUnknownKeys로 API 변경에 대한 호환성을 확보했습니다. 네트워크 모듈에 적합한 설정입니다.


37-47: HTTP 로깅 인터셉터 설정이 잘 구현되어 있습니다.

Logger 라이브러리와의 통합이 적절하며, 디버그 빌드에서만 상세 로깅(Level.BODY)을 활성화하여 성능과 보안을 고려했습니다.


20-20: 타임아웃 설정이 적절합니다.

15초 타임아웃은 모바일 앱에 적합한 값이며, 연결, 읽기, 쓰기 타임아웃을 동일하게 설정한 것은 일반적인 관례입니다.

Also applies to: 55-57

Comment on lines +51 to +52
internal fun providePokemonOkHttpClient(
httpLoggingInterceptor: HttpLoggingInterceptor,
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Jun 21, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

함수 이름에서 잘못된 도메인 용어를 수정해야 합니다.

함수 이름에 "Pokemon"이 포함되어 있는데, 이는 "Booket" 프로젝트와 맞지 않습니다. 다른 프로젝트에서 코드를 복사할 때 발생한 것으로 보입니다.

다음과 같이 수정하세요:

-    internal fun providePokemonOkHttpClient(
+    internal fun provideBooketOkHttpClient(
         httpLoggingInterceptor: HttpLoggingInterceptor,
     ): OkHttpClient {

-    internal fun providePokemonApiRetrofit(
+    internal fun provideBooketApiRetrofit(
         okHttpClient: OkHttpClient,
     ): Retrofit {

Also applies to: 64-65

🤖 Prompt for AI Agents
In
core/network/src/main/kotlin/com/ninecraft/booket/core/network/di/NetworkModule.kt
at lines 51-52 and 64-65, the function names incorrectly include the term
"Pokemon," which is unrelated to the Booket project domain. Rename these
functions to remove "Pokemon" and use appropriate Booket-related terminology to
reflect the correct project context.

Copy link
Copy Markdown
Contributor Author

@easyhooon easyhooon Jun 21, 2025

Choose a reason for hiding this comment

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

예리하네,, (복사해온거 들켰누) 9b96dd3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

@easyhooon 하하, 코드 리뷰의 묘미죠! 😄

복사-붙여넣기는 개발에서 흔한 일이지만, 도메인 용어 일관성을 맞춰주는 것이 중요합니다. PokemonBooket으로 수정해주시면 됩니다.

혹시 다른 곳에도 Pokemon 관련 용어가 남아있는지 확인해드릴게요!


🏁 Script executed:

#!/bin/bash
# Check if there are any other occurrences of "Pokemon" in the codebase that might need fixing
rg -i "pokemon" --type kt

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Check for "Pokemon" occurrences in Kotlin files using glob pattern
rg -i "pokemon" -g "*.kt"

# Also check Gradle files in case there are references there
rg -i "pokemon" -g "*.gradle.kts"

# Check all files just to be thorough
rg -i "pokemon"

Length of output: 75


좋은 소식입니다! 🎉

다른 곳에는 "Pokemon" 관련 용어가 없네요. 그러니까 제가 처음에 지적한 NetworkModule.kt의 두 함수명만 수정하시면 됩니다:

  • providePokemonOkHttpClientprovideOkHttpClient (또는 provideBooketOkHttpClient)
  • 그리고 diff에서 보이지 않았지만 아마 providePokemonApiRetrofit 같은 함수도 있을 것 같네요

솔직하게 인정해주셔서 감사하고, 이런 실수는 정말 흔한 일입니다. 코드 재사용은 좋은 습관이지만 도메인에 맞게 네이밍 정리만 해주시면 완벽해질 것 같아요! 😊

)
}

fun getServerBaseUrl(propertyKey: String): String {
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.

local.properties 파일 공유되게 세팅해 주시면 좋을 것 같습니다 (or 노션에 게시)

Copy link
Copy Markdown
Contributor Author

@easyhooon easyhooon Jun 21, 2025

Choose a reason for hiding this comment

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

local.properties 파일 공유되게 세팅해 주시면 좋을 것 같습니다 (or 노션에 게시)

@seoyoon513 노션에 공유 완료

@easyhooon easyhooon merged commit e7e6dd4 into develop Jun 21, 2025
4 checks passed
@easyhooon easyhooon deleted the BOOK-46-feature/#5 branch June 21, 2025 13:02
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.

[BOOK-46/feat] 네트워크 모듈 설계 및 구현

2 participants