Skip to content

[API] api 연결 세팅#64

Merged
rbqks529 merged 6 commits intoTHIP-TextHip:developfrom
Nico1eKim:api/#62-api_setting
Aug 4, 2025
Merged

[API] api 연결 세팅#64
rbqks529 merged 6 commits intoTHIP-TextHip:developfrom
Nico1eKim:api/#62-api_setting

Conversation

@Nico1eKim
Copy link
Member

@Nico1eKim Nico1eKim commented Aug 3, 2025

➕ 이슈 링크


🔎 작업 내용

  • api 통신 세팅 완료했습니다

📸 스크린샷

서버와 통신 성공(토큰이 없어서 401)

스크린샷 2025-08-04 오전 1 15 22

패키지 구조 예시

image


📢 리뷰어들에게

  • 서버와 통신에 성공했습니다! 아직 token을 불러오는 코드가 없어서 401이 뜹니닷
  • 위에 첨부한 패키지 구조 예시처럼 구현할 때 data 패키지 안에 model 패키지 안에 response, request 패키지 각각 만들고, repository 패키지 안에 파일 만들고, service 패키지 안에 파일 만들고 service module에 Service 불러와서 구현하면 됩니다!

Summary by CodeRabbit

  • 신규 기능

    • Dagger Hilt 기반 의존성 주입 및 Retrofit, OkHttp 네트워크 기능 통합
    • API 응답을 표준화하여 처리하는 공통 응답 모델과 예외 처리 기능 추가
    • MainActivity에 Hilt AndroidEntryPoint 적용 및 커스텀 Application 클래스 도입
  • 설정 및 빌드

    • Hilt, Retrofit, OkHttp 등 관련 라이브러리 및 플러그인 추가
    • BASE_URL 등 환경설정 값을 외부 파일에서 읽어 빌드에 반영하도록 개선
    • 컴파일러 및 Gradle 설정을 최신 Java 버전(21) 및 동적 환경 변수 사용으로 업데이트
    • Android Gradle Plugin 및 Kotlin 버전 업데이트, 라이브러리 버전 관리 체계 개선

@coderabbitai
Copy link

coderabbitai bot commented Aug 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

이 변경 사항은 Dagger Hilt 기반의 의존성 주입과 Retrofit+OkHttp 네트워킹 구성을 앱에 도입합니다. 또한 API 응답 모델 및 핸들러를 추가하고, Gradle 및 프로젝트 설정 파일을 최신 Java(21)와 동적 Gradle JVM 경로로 업데이트합니다. 앱의 Application 클래스를 커스텀하고, 관련 라이브러리 버전을 명시합니다.

Changes

Cohort / File(s) Change Summary
빌드 및 환경 설정
.idea/compiler.xml, .idea/gradle.xml, build.gradle.kts, gradle/libs.versions.toml, app/build.gradle.kts
JVM 타겟 및 Gradle JVM 버전을 21 및 동적 경로로 변경. Hilt, Retrofit, OkHttp 등 네트워크/DI 관련 라이브러리 버전 및 의존성 추가. buildConfig, kapt 등 빌드 설정 보강.
Application 및 진입점 설정
app/src/main/AndroidManifest.xml, app/src/main/java/com/texthip/thip/ThipApplication.kt, app/src/main/java/com/texthip/thip/MainActivity.kt
커스텀 Application 클래스(ThipApplication) 추가 및 매니페스트 등록. MainActivity에 Hilt 진입점 어노테이션 추가.
네트워크 DI 모듈
app/src/main/java/com/texthip/thip/data/di/NetworkModule.kt, app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt
Hilt DI 모듈로 네트워크 관련 싱글톤(OkHttp, Retrofit, LoggingInterceptor, Json) 제공. ServiceModule은 구조만 추가(구현 없음).
API 응답 모델 및 핸들러
app/src/main/java/com/texthip/thip/data/model/base/BaseResponse.kt, app/src/main/java/com/texthip/thip/data/model/base/ApiResponseHandler.kt
API 표준 응답 모델(BaseResponse) 및 응답 핸들러/예외(handleBaseResponse, ThipApiFailureException) 추가.

Sequence Diagram(s)

sequenceDiagram
    participant App as ThipApplication
    participant Hilt as Dagger Hilt
    participant Network as NetworkModule
    participant Retrofit as Retrofit
    participant OkHttp as OkHttpClient

    App->>Hilt: @HiltAndroidApp 초기화
    Hilt->>Network: NetworkModule DI 구성
    Network->>OkHttp: OkHttpClient/LoggingInterceptor 제공
    Network->>Retrofit: Retrofit 인스턴스 제공 (BASE_URL, Json, OkHttp)
    App->>Retrofit: API 요청 수행
    Retrofit->>App: BaseResponse 반환
    App->>App: handleBaseResponse()로 결과 처리
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Assessment against linked issues

Objective Addressed Explanation
API 연결 세팅 (#62)

Assessment against linked issues: Out-of-scope changes

(해당 없음)

Suggested labels

🍀 refactor

Suggested reviewers

  • Nico1eKim

Poem

🐇
새싹처럼 DI 뿌리 내려
Hilt와 Retrofit, OkHttp가 모여
API 응답도 한 번에 쏙!
네트워크 세팅, 토끼도 똑똑
코드밭에 봄바람 솔솔
이제 서버랑 친구 먹을 차례!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 870b7cc and 06a3cde.

📒 Files selected for processing (1)
  • gradle/libs.versions.toml (2 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 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.
  • 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.

Support

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

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 generate unit tests to generate unit tests for 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

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

🧹 Nitpick comments (3)
build.gradle.kts (1)

6-6: 플러그인 버전을 libs.versions.toml에서 관리하도록 통일하는 것이 유지보수에 유리합니다
다른 플러그인들은 alias(libs.plugins.*) 형태로 버전을 중앙 집중화했는데, Hilt 플러그인만 코드 상수로 직접 명시되어 있습니다. 향후 버전 업 시 누락될 수 있으니 TOML 파일에 선언 후 alias(libs.plugins.hilt.android)와 같이 사용하는 방식을 권장합니다.

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

5-7: android:name는 전체 패키지명을 사용하는 편이 명시적입니다
상위 <manifest> 태그의 package 속성에 의존한 상대 경로(.ThipApplication) 대신 com.texthip.thip.ThipApplication처럼 절대 경로로 지정하면 라이브러리 모듈로 분리될 때 혼동을 줄일 수 있습니다.

app/src/main/java/com/texthip/thip/data/model/base/BaseResponse.kt (1)

11-11: 프로퍼티 명과 JSON 필드명의 일관성을 개선하세요.

@SerialName("data")로 지정되어 있지만 프로퍼티명은 response로 되어 있어 혼동을 줄 수 있습니다.

일관성을 위해 다음 중 하나로 수정하는 것을 권장합니다:

-    @SerialName("data") val response: T? = null,
+    @SerialName("data") val data: T? = null,

또는

-    @SerialName("data") val response: T? = null,
+    @SerialName("response") val response: T? = null,
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6290b07 and 870b7cc.

📒 Files selected for processing (12)
  • .idea/compiler.xml (1 hunks)
  • .idea/gradle.xml (1 hunks)
  • app/build.gradle.kts (4 hunks)
  • app/src/main/AndroidManifest.xml (1 hunks)
  • app/src/main/java/com/texthip/thip/MainActivity.kt (1 hunks)
  • app/src/main/java/com/texthip/thip/ThipApplication.kt (1 hunks)
  • app/src/main/java/com/texthip/thip/data/di/NetworkModule.kt (1 hunks)
  • app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt (1 hunks)
  • app/src/main/java/com/texthip/thip/data/model/base/ApiResponseHandler.kt (1 hunks)
  • app/src/main/java/com/texthip/thip/data/model/base/BaseResponse.kt (1 hunks)
  • build.gradle.kts (1 hunks)
  • gradle/libs.versions.toml (4 hunks)
🔇 Additional comments (13)
.idea/gradle.xml (1)

9-9: 환경 변수 #GRADLE_LOCAL_JAVA_HOME 설정 여부 확인 필수

고정 JDK 버전 대신 동적 플레이스홀더로 전환되었습니다.
CI/CD 파이프라인이나 다른 개발자의 IDE 환경에서 해당 환경 변수가 정의되지 않으면 Gradle이 JVM을 찾지 못해 빌드가 중단될 수 있습니다.

필요 시 다음 중 하나를 검토해 주세요.

  1. 파이프라인 설정에 GRADLE_LOCAL_JAVA_HOME 변수를 추가하여 JDK 21 경로를 지정
  2. IDEA 공유 설정을 VCS에서 제외하고, JDK 버전을 gradle.properties 또는 build.gradlejava.toolchain으로 통일
.idea/compiler.xml (1)

4-4: 바이트코드 타겟 레벨 21 적용 – 빌드 환경의 JDK 21 지원 여부 점검

컴파일 타겟을 17에서 21로 올렸습니다.
로컬 IDE 설정만 변경된 경우라면 Gradle/CI에서는 여전히 JDK 17로 빌드되어 불일치가 발생할 수 있으니, 다음을 확인해 주세요.

  • build.gradle 또는 gradle.propertiesjava { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } } 설정 추가
  • CI 이미지가 JDK 21을 사용하도록 업데이트
gradle/libs.versions.toml (1)

3-6: Retrofit 3.0.0 및 Converter-Gson 3.0.0이 이미 배포되어 있습니다
Maven Central에서 확인한 결과 retrofitconverter-gson 최신 버전은 3.0.0으로, 의존성 해상도 문제가 없습니다. 별도 수정이 필요하지 않습니다.

Likely an incorrect or invalid review comment.

app/src/main/java/com/texthip/thip/MainActivity.kt (1)

15-18: Hilt 주입 지점 설정 완료 확인
@AndroidEntryPoint 추가로 DI 지점이 정상 구성되었습니다. ThipApplication과 모듈이 이미 존재하므로 런타임 주입에 문제 없을 것으로 보입니다.

app/src/main/java/com/texthip/thip/ThipApplication.kt (1)

6-7: Hilt Application 클래스 구현 확인 완료
필요 최소 구현으로 충분하며 추가 로직이 없으므로 깔끔합니다. 프로가드 사용 시 -keep 규칙만 누락되지 않도록 주의하세요.

app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt (1)

7-12: 올바른 Hilt 모듈 구조입니다.

현재는 빈 모듈이지만 향후 서비스 관련 의존성 제공을 위한 적절한 구조로 설정되어 있습니다. @InstallIn(SingletonComponent::class) 설정도 올바릅니다.

app/src/main/java/com/texthip/thip/data/model/base/BaseResponse.kt (1)

6-12: 표준적인 API 응답 구조가 잘 정의되었습니다.

제네릭 타입을 사용한 재사용 가능한 구조와 kotlinx.serialization 어노테이션 사용이 적절합니다.

app/build.gradle.kts (1)

8-10: Hilt 및 kapt 설정이 올바르게 구성되었습니다.

의존성 주입을 위한 Hilt 플러그인과 kapt 설정이 적절합니다. correctErrorTypes = true 설정도 어노테이션 처리 정확성을 높이는 좋은 선택입니다.

Also applies to: 95-97

app/src/main/java/com/texthip/thip/data/model/base/ApiResponseHandler.kt (2)

3-14: 깔끔한 응답 처리 로직입니다.

Result 타입을 사용한 에러 처리 방식이 적절하고, 성공/실패 케이스를 명확하게 구분하고 있습니다.


16-19: 사용자 정의 예외 클래스가 잘 정의되었습니다.

API 실패 시 코드와 메시지를 포함하는 구조화된 예외 처리가 좋습니다. Throwable을 상속받은 구조도 적절합니다.

app/src/main/java/com/texthip/thip/data/di/NetworkModule.kt (3)

40-47: 타임아웃 설정을 검토하세요.

10초 타임아웃이 모든 API 요청에 적절한지 확인이 필요합니다. 파일 업로드나 큰 데이터 처리 API의 경우 더 긴 타임아웃이 필요할 수 있습니다.

API 서버의 응답 시간과 예상되는 요청 유형을 고려하여 타임아웃 값이 적절한지 확인해주세요.


21-31: JSON 직렬화 설정이 잘 구성되었습니다.

유연한 JSON 파싱을 위한 설정들이 적절하며, 주석을 통해 각 설정의 목적이 명확하게 설명되어 있습니다.


37-38: 향후 인증 구현을 위한 준비가 잘 되어 있습니다.

주석 처리된 인증 인터셉터와 인증자는 토큰 기반 인증 구현 시 쉽게 활성화할 수 있도록 준비되어 있습니다.

Also applies to: 45-46

Comment on lines +12 to 14
val properties = Properties().apply {
load(project.rootProject.file("local.properties").inputStream())
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

local.properties 파일 존재 여부를 검증하세요.

local.properties 파일이 존재하지 않을 경우 빌드가 실패할 수 있습니다.

다음 스크립트로 파일 존재 여부와 BASE_URL 설정을 확인해주세요:


🏁 Script executed:

#!/bin/bash
# local.properties 파일과 BASE_URL 설정 확인
if [ -f "local.properties" ]; then
    echo "local.properties 파일 존재함"
    grep "BASE_URL" local.properties || echo "BASE_URL 설정이 없습니다"
else
    echo "local.properties 파일이 존재하지 않습니다"
fi

# .gitignore에서 local.properties 제외 여부 확인
grep -n "local.properties" .gitignore || echo "local.properties가 .gitignore에 없습니다"

Length of output: 178


local.properties 파일 누락 및 예시 파일(example) 추가 필요

현재 루트 디렉토리에 local.properties 파일이 없으며, .gitignore/local.propertieslocal.properties가 모두 등록되어 있습니다.
이대로라면 Gradle에서 project.rootProject.file("local.properties")를 로드할 때 빌드가 실패합니다.

해야 할 작업:

  • 루트에 local.properties.example (또는 local.properties.template) 파일을 추가하고, README 등에 실제 local.properties 생성 및 BASE_URL 설정 방법을 문서화하세요.
  • app/build.gradle.kts에서 파일이 없을 경우 기본값을 설정하거나 로드 구문을 감싸서 빌드 실패를 방지하는 처리(.exists() 체크 등)를 추가하세요.

대략적인 코드 예시:

 val properties = Properties().apply {
-    load(project.rootProject.file("local.properties").inputStream())
+    val propFile = project.rootProject.file("local.properties")
+    if (propFile.exists()) {
+        load(propFile.inputStream())
+    } else {
+        logger.warn("local.properties not found: using default BASE_URL")
+        setProperty("BASE_URL", "https://default.example.com")
+    }
 }
🤖 Prompt for AI Agents
In app/build.gradle.kts around lines 12 to 14, the code loads local.properties
without checking if the file exists, causing build failures if the file is
missing. To fix this, first add a local.properties.example file in the root
directory with example settings and document how to create the actual
local.properties in the README. Then, modify the build.gradle.kts to check if
local.properties exists before loading it, and provide default values or skip
loading if it does not exist to prevent build errors.

Comment on lines +81 to +93
implementation(libs.hilt.android)
kapt(libs.hilt.android.compiler)
implementation(libs.androidx.hilt.navigation.compose)

// Retrofit
implementation(libs.retrofit)
implementation(libs.converter.gson)
implementation(libs.retrofit.kotlin.serialization.converter)

// OkHttp
implementation(libs.okhttp)
implementation(libs.logging.interceptor)
}
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

의존성 버전을 확인하세요.

Hilt, Retrofit, OkHttp 라이브러리들의 버전 호환성과 최신 보안 패치 적용 여부를 확인하는 것이 좋습니다.

라이브러리 최신 버전을 확인해주세요:


🌐 Web query:

Dagger Hilt, Retrofit, OkHttp의 최신 안정 버전과 보안 권고사항을 알려주세요

💡 Result:

안녕하세요! Dagger Hilt, Retrofit, OkHttp의 최신 안정 버전과 보안 권고사항에 대해 알려드리겠습니다.

최신 안정 버전:

  • Dagger Hilt: 최신 안정 버전은 2.48입니다.
  • Retrofit: 최신 안정 버전은 2.9.0입니다.
  • OkHttp: 최신 안정 버전은 4.9.3입니다.

이러한 버전들은 각 라이브러리의 공식 문서나 GitHub 저장소에서 확인하실 수 있습니다.

보안 권고사항:

  1. 의존성 최신 상태 유지: 보안 취약점을 최소화하기 위해 사용하는 라이브러리의 버전을 최신 상태로 유지하는 것이 중요합니다.

  2. HTTPS 사용: 네트워크 통신 시 HTTPS를 사용하여 데이터 전송의 보안을 강화하세요.

  3. 네트워크 보안 설정: 안드로이드 앱의 network_security_config.xml 파일을 활용하여 보안 정책을 설정하고, 신뢰할 수 있는 도메인만 허용하도록 구성하세요.

  4. 인증서 검증 강화: 서버와의 통신 시 SSL/TLS 인증서를 철저히 검증하여 중간자 공격을 방지하세요.

  5. 의존성 주입 시 주의: Dagger Hilt를 사용할 때, 의존성 주입 대상의 범위를 명확히 정의하고, 필요하지 않은 의존성은 주입하지 않도록 주의하세요.

이러한 권고사항을 따르면 앱의 보안을 강화할 수 있습니다.


의존성 버전 업데이트 및 보안 강화 권고

아래 라이브러리들이 최신 안정 버전인지 확인하고, 필요 시 버전을 상향 조정해주세요. 또한 보안 권고사항을 참고해 네트워크 통신 설정을 강화하시기 바랍니다.

  • Hilt
    – 최신 안정 버전: 2.48
    libs.hilt.android(및 관련 kapt, navigation.compose) 설정이 2.48 이상인지 확인 후 업데이트
  • Retrofit
    – 최신 안정 버전: 2.9.0
    libs.retrofit, libs.converter.gson, libs.retrofit.kotlin.serialization.converter 버전 검토 및 상향
  • OkHttp
    – 최신 안정 버전: 4.9.3
    libs.okhttp, libs.logging.interceptor 버전 검토 및 상향

보안 권고사항

  • HTTPS 프로토콜 사용 여부 확인
  • network_security_config.xml 에서 신뢰할 도메인만 허용하도록 설정
  • SSL/TLS 인증서 유효성 검증 강화
  • Dagger Hilt 의존성 주입 대상(scope) 명확화 및 불필요 주입 최소화
🤖 Prompt for AI Agents
In app/build.gradle.kts around lines 81 to 93, verify and update the versions of
Hilt, Retrofit, and OkHttp dependencies to at least Hilt 2.48, Retrofit 2.9.0,
and OkHttp 4.9.3 respectively by adjusting the version references in the libs
configuration. Additionally, review your network security settings to ensure
HTTPS is enforced, restrict trusted domains in network_security_config.xml,
strengthen SSL/TLS certificate validation, and refine Dagger Hilt dependency
injection scopes to minimize unnecessary injections.

Comment on lines +51 to +54
fun providesLoggingInterceptor(): HttpLoggingInterceptor =
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

로깅 레벨을 환경에 따라 조정하세요.

현재 BODY 레벨로 설정되어 있어 프로덕션 환경에서 민감한 데이터가 로그에 노출될 수 있습니다.

BuildConfig를 활용해 디버그/릴리즈 환경에 따라 로깅 레벨을 조정하세요:

 fun providesLoggingInterceptor(): HttpLoggingInterceptor =
     HttpLoggingInterceptor().apply {
-        level = HttpLoggingInterceptor.Level.BODY
+        level = if (BuildConfig.DEBUG) {
+            HttpLoggingInterceptor.Level.BODY
+        } else {
+            HttpLoggingInterceptor.Level.NONE
+        }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fun providesLoggingInterceptor(): HttpLoggingInterceptor =
HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}
fun providesLoggingInterceptor(): HttpLoggingInterceptor =
HttpLoggingInterceptor().apply {
level = if (BuildConfig.DEBUG) {
HttpLoggingInterceptor.Level.BODY
} else {
HttpLoggingInterceptor.Level.NONE
}
}
🤖 Prompt for AI Agents
In app/src/main/java/com/texthip/thip/data/di/NetworkModule.kt around lines 51
to 54, the HttpLoggingInterceptor is set to log at BODY level unconditionally,
which risks exposing sensitive data in production. Modify the code to check the
build environment using BuildConfig and set the logging level to BODY only in
debug builds, while setting it to NONE or a less verbose level in release builds
to protect sensitive information.

okHttpClient: OkHttpClient
): Retrofit =
Retrofit.Builder()
.baseUrl(BuildConfig.BASE_URL)
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

BASE_URL 설정을 검증하세요.

BuildConfig.BASE_URL이 올바르게 설정되었는지 확인이 필요합니다.

다음 스크립트로 BASE_URL 설정을 확인해주세요:


🏁 Script executed:

#!/bin/bash
# BuildConfig 파일에서 BASE_URL 확인
fd -t f -e java "BuildConfig" --exec grep -l "BASE_URL" {} \;

Length of output: 62


🏁 Script executed:

#!/bin/bash
# 전체 코드베이스에서 BASE_URL 정의 및 사용 위치 검색
rg -n 'BASE_URL'
# build.gradle(.kts) 파일에서 buildConfigField BASE_URL 정의 확인
rg -n 'buildConfigField.*BASE_URL' -g '*.gradle' -g '*.gradle.kts'

Length of output: 399


🏁 Script executed:

#!/bin/bash
# gradle.properties 및 local.properties에서 BASE_URL 정의 여부 확인
rg -n 'BASE_URL' -g '*.properties'

Length of output: 34


BASE_URL 프로퍼티 정의 누락 확인 및 설정 필요

app/build.gradle.kts (29행)에서

buildConfigField("String", "BASE_URL", "\"${properties["BASE_URL"]}\"")

BuildConfig.BASE_URL을 설정하고 있지만, 프로젝트 루트의 gradle.propertieslocal.properties에서 해당 BASE_URL 프로퍼티가 정의되어 있지 않습니다.

해결 방안:

  • gradle.properties 또는 local.properties에 다음과 같이 BASE_URL을 추가하세요.
    BASE_URL="https://your.api.endpoint/"
  • CI/CD 환경에서 Gradle 빌드 시 -PBASE_URL=... 옵션으로 값이 전달되는지 확인하세요.
🤖 Prompt for AI Agents
In app/src/main/java/com/texthip/thip/data/di/NetworkModule.kt at line 63, the
BuildConfig.BASE_URL is used but the BASE_URL property is not defined in the
project configuration. To fix this, add the BASE_URL property with the
appropriate API endpoint URL to either gradle.properties or local.properties in
the project root, for example BASE_URL="https://your.api.endpoint/". Also ensure
that in CI/CD builds, the BASE_URL is passed as a Gradle property using the
-PBASE_URL=... option.

Copy link
Collaborator

@rbqks529 rbqks529 left a comment

Choose a reason for hiding this comment

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

코드 확인했고 질문에 답변 부탁드립니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

서비스 모듈은 어떻게 사용하면 되나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

    @Provides
    @Singleton
    fun provideAuthService(retrofit: Retrofit): AuthService {
        return retrofit.create(AuthService::class.java)
    }

이런 식으로 사용하면 됩니닷 ! serivce를 만들때마다 service module에 선언해서 사용하시면 됩니닷

versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분은 어떤 뜻인가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

local properties에서 BASE_URL을 가져와서 build config에 상수화하는 역할입니닷 ! base url을 드러내지 않기 위해서 이런 코드를 작성했습니닷

@rbqks529 rbqks529 merged commit 40d6049 into THIP-TextHip:develop Aug 4, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] api 연결 세팅 [(THIP2025-177)]

2 participants