Skip to content

[Refactor/#17] DI 생성 책임을 app 모듈로 이관#19

Merged
wjdrjs00 merged 7 commits intodevelopfrom
refactor/#17-di-unification
Jul 6, 2025
Merged

[Refactor/#17] DI 생성 책임을 app 모듈로 이관#19
wjdrjs00 merged 7 commits intodevelopfrom
refactor/#17-di-unification

Conversation

@wjdrjs00
Copy link
Copy Markdown
Member

@wjdrjs00 wjdrjs00 commented Jul 6, 2025

[ PR Content ]

core 모듈 간 의존성 연결로 인해 순환 참조 가능성 문제가 발생할 여지가 있어 의존성 생성 책임을 app 모듈로 일괄 이동했습니다.
DI 조립은 app에서 통합 관리하는 구조로 변경했습니다.

Related issue

Screenshot 📸

  • N/A

Work Description

  • network, security, datastore 관련 의존성 생성을 app 모듈에서 담당
  • core 모듈은 DI 대상만 주입받도록 설계 변경

To Reviewers 📢

  • 처음 적용해보는 방식이라,, 의존성 주입 흐름이 어색하지 않은지 확인 부탁드립니담!

Summary by CodeRabbit

  • 신규 기능

    • 인증 토큰 암호화 및 복호화를 위한 인터페이스가 추가되었습니다.
    • 인증 토큰 저장소 생성 및 관리 기능이 도입되었습니다.
    • 인증 토큰을 비동기적으로 제공하는 토큰 제공자 인터페이스가 추가되었습니다.
  • 버그 수정

    • 네트워크 인증 인터셉터가 토큰 제공자를 통해 토큰을 안전하게 획득하도록 개선되었습니다.
    • 토큰 인증자에서 토큰 저장소 의존성이 제거되어 인증 처리 로직이 단순화되었습니다.
  • 리팩터링

    • 패키지 구조와 클래스 네이밍이 정비되어 모듈별 책임이 명확해졌습니다.
    • 의존성 주입 모듈이 재구성되고, 보안 관련 클래스들의 접근성이 공개로 변경되었습니다.
    • 데이터 저장소 및 직렬화 관련 클래스들이 auth 하위 패키지로 이동 및 재구성되었습니다.
  • 테스트

    • 인증 토큰 직렬화 테스트가 새로운 구조와 구현체에 맞게 리팩터링되었습니다.

wjdrjs00 added 5 commits July 6, 2025 11:12
- DataStore 관련 파일들을 datastore/auth 하위 패키지로 이동
- AuthTokenStorageFactory 추가
- TokenCrypto 인터페이스 추가
- core:datastore 모듈의 hilt 및 security 의존성 제거
- TokenProvider 인터페이스를 통해 토큰을 가져오도록 수정
- TokenProvider의 구현체를 제공하는 provideTokenStore 메소드 추가
- core/network 모듈에서 core/datastore 의존성 제거
@wjdrjs00 wjdrjs00 requested a review from l5x5l July 6, 2025 04:16
@wjdrjs00 wjdrjs00 self-assigned this Jul 6, 2025
@wjdrjs00 wjdrjs00 added 🔨 Refactor 기존 기능 개선 🧤 대현 labels Jul 6, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 6, 2025

Walkthrough

DI(Dependency Injection) 관련 모듈과 구현체가 core 모듈에서 app 모듈로 이동되었으며, DataStore와 Security 관련 DI 구성이 app 모듈 내에서 통합 관리되도록 리팩토링되었습니다. 또한, Token 관련 인터페이스와 구현체, Serializer 구조가 새롭게 정의되고, 기존의 중복 또는 불필요한 코드가 제거되었습니다.

Changes

파일/경로 그룹 변경 요약
app/src/main/java/com/threegap/bitnagil/di/core/DataStoreModule.kt
app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt
app/src/main/java/com/threegap/bitnagil/di/core/Qualifier.kt
app/src/main/java/com/threegap/bitnagil/di/core/SecurityModule.kt
DataStore, Network, Security DI 모듈 app 모듈로 이동 및 패키지 정리, 신규/수정된 Provider 메소드 추가
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/crypto/TokenCrypto.kt
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializer.kt
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenStorageFactory.kt
core/network/src/main/java/com/threegap/bitnagil/network/token/TokenProvider.kt
TokenCrypto, AuthTokenSerializer, AuthTokenStorageFactory, TokenProvider 등 신규 인터페이스 및 팩토리 추가
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/model/AuthToken.kt
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt
core/datastore/src/test/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImplTest.kt
AuthToken, AuthTokenDataStore 관련 파일 패키지 이동 및 가시성(public) 변경, @Inject 제거 등 구조 개선
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializerImpl.kt
core/datastore/src/test/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializerImplTest.kt
AuthTokenSerializerImpl로 클래스명 변경, TokenCrypto 적용, 테스트 코드 패키지/이름 정리 및 타입 변경
core/datastore/src/main/java/com/threegap/bitnagil/datastore/di/DataStoreModule.kt
core/datastore/src/main/java/com/threegap/bitnagil/datastore/serializer/TokenSerializer.kt
기존 DataStoreModule, TokenSerializer 등 불필요/중복 코드 삭제
core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt
core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
AuthTokenDataStore 의존성 → TokenProvider로 교체, TokenAuthenticator 생성자 변경 및 로직 단순화
core/datastore/build.gradle.kts
core/network/build.gradle.kts
core/security/build.gradle.kts
Hilt 플러그인 및 core.datastore, core.security 종속성 제거
core/security/src/main/java/com/threegap/bitnagil/security/crypto/SecureCrypto.kt
core/security/src/main/java/com/threegap/bitnagil/security/keystore/AndroidKeyProvider.kt
SecureCrypto, AndroidKeyProvider 가시성 internal → public 변경

Sequence Diagram(s)

sequenceDiagram
    participant AppModule
    participant DataStoreModule
    participant Crypto
    participant TokenCrypto
    participant AuthTokenSerializer
    participant AuthTokenDataStore
    participant NetworkModule
    participant TokenProvider

    AppModule->>DataStoreModule: DI 초기화
    DataStoreModule->>Crypto: Crypto 인스턴스 주입
    DataStoreModule->>TokenCrypto: TokenCrypto 생성(crypto 위임)
    DataStoreModule->>AuthTokenSerializer: AuthTokenSerializer 생성(TokenCrypto 주입)
    DataStoreModule->>AuthTokenDataStore: AuthTokenDataStore 생성(context, AuthTokenSerializer)
    NetworkModule->>TokenProvider: TokenProvider 생성(AuthTokenDataStore 주입)
Loading

Assessment against linked issues

Objective (이슈 번호) Addressed Explanation
core:datastore, core:security DI 컨테이너 app 모듈로 이동 (#17)

Possibly related PRs

Suggested reviewers

  • l5x5l

Poem

🐰
DI 모듈 hop! hop!
core에서 app으로 깡총깡총
Token도, Crypto도 한데 모아
의존성 주입, 깔끔하게 정리
깡총이는 오늘도 코드 정원에서
구조를 다듬으며 춤을 춰요!
🌱✨


📜 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 ac07ae0 and 8034670.

📒 Files selected for processing (3)
  • core/network/build.gradle.kts (0 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt (1 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (1 hunks)
💤 Files with no reviewable changes (1)
  • core/network/build.gradle.kts
🚧 Files skipped from review as they are similar to previous changes (2)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: 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: 2

🧹 Nitpick comments (8)
core/security/src/main/java/com/threegap/bitnagil/security/crypto/SecureCrypto.kt (1)

7-7: 클래스 가시성 변경이 DI 구조 개선에 적절합니다

SecureCrypto를 public으로 변경하여 app 모듈의 DI에서 사용할 수 있도록 한 것은 적절합니다. 다만 public API가 되면서 향후 변경 시 하위 호환성을 고려해야 합니다.

core/security/src/main/java/com/threegap/bitnagil/security/keystore/AndroidKeyProvider.kt (1)

9-9: 보안 관련 클래스의 가시성 변경이 적절합니다

AndroidKeyProvider를 public으로 변경하여 app 모듈의 DI에서 사용할 수 있도록 한 것은 적절합니다. 보안 관련 클래스이므로 향후 변경 시 보안 영향도를 충분히 검토해야 합니다.

core/datastore/src/test/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImplTest.kt (1)

32-56: readFrom 블로킹 I/O 가능성

writeTowithContext(Dispatchers.IO)로 감싸면서 I/O 스레드를 분리한 반면, readFrom에서는 같은 고려가 없습니다. 테스트 코드라 큰 문제는 아니지만, 구현 예시로 복사될 가능성을 생각하면 일관성을 맞춰 두는 편이 안전합니다.

-override suspend fun readFrom(input: InputStream): AuthToken {
-    return try {
-        input.bufferedReader().use {
-            Json.decodeFromString(AuthToken.serializer(), it.readText())
-        }
-    } catch (e: Exception) {
-        AuthToken()
-    }
-}
+override suspend fun readFrom(input: InputStream): AuthToken =
+    withContext(Dispatchers.IO) {
+        try {
+            input.bufferedReader().use {
+                Json.decodeFromString(AuthToken.serializer(), it.readText())
+            }
+        } catch (e: Exception) {
+            AuthToken()
+        }
+    }
core/network/src/main/java/com/threegap/bitnagil/network/token/TokenProvider.kt (1)

3-5: KDoc 주석 추가 제안

공통 인터페이스이므로 간단한 KDoc 한 줄만 있어도 사용 의도가 분명해집니다.

/**
 * 네트워크 계층에서 인증 토큰을 비동기로 제공하기 위한 Provider.
 */
interface TokenProvider {
    suspend fun getToken(): String?
}
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializer.kt (1)

1-6: 타입 alias로 단순화 가능

추가 메서드가 없으므로 굳이 인터페이스로 감쌀 필요 없이 typealias로 충분합니다. DI 식별자가 필요하다면 @Qualifier로 해결할 수 있습니다.

-package com.threegap.bitnagil.datastore.auth.serializer
-
-import androidx.datastore.core.Serializer
-import com.threegap.bitnagil.datastore.auth.model.AuthToken
-
-interface AuthTokenSerializer : Serializer<AuthToken>
+package com.threegap.bitnagil.datastore.auth.serializer
+
+import androidx.datastore.core.Serializer
+import com.threegap.bitnagil.datastore.auth.model.AuthToken
+
+typealias AuthTokenSerializer = Serializer<AuthToken>
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/crypto/TokenCrypto.kt (1)

3-6: CPU 집중 작업의 suspend 처리 고려

암·복호화 구현이 CPU-집중 또는 I/O-집중일 가능성이 있다면 suspend 키워드를 붙여 코루틴 친화적으로 만드는 방안을 검토해주세요. 현재 형태로도 동작은 하지만, 나중에 무거운 알고리즘으로 교체될 때 호출 지점 수정이 필요해집니다.

app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt (1)

114-119: TokenProvider 구현체 제공이 잘 구현되었습니다.

AuthTokenDataStore를 TokenProvider로 브릿지하는 구현이 깔끔합니다. 다만 tokenFlow.first() 호출이 빈번한 경우 성능에 영향을 줄 수 있으니 필요시 캐싱 전략을 고려해보세요.

app/src/main/java/com/threegap/bitnagil/di/core/DataStoreModule.kt (1)

20-27: TokenCrypto 구현을 별도 클래스로 추출 검토

익명 객체 대신 명시적인 구현 클래스를 만들면 테스트 용이성과 재사용성이 향상됩니다.

별도 파일에 구현 클래스 생성:

class TokenCryptoImpl @Inject constructor(
    private val crypto: Crypto
) : TokenCrypto {
    override fun encrypt(bytes: ByteArray): ByteArray = crypto.encrypt(bytes)
    override fun decrypt(bytes: ByteArray): ByteArray = crypto.decrypt(bytes)
}

그리고 모듈에서:

-    fun provideTokenCrypto(crypto: Crypto): TokenCrypto =
-        object : TokenCrypto {
-            override fun encrypt(bytes: ByteArray): ByteArray = crypto.encrypt(bytes)
-
-            override fun decrypt(bytes: ByteArray): ByteArray = crypto.decrypt(bytes)
-        }
+    fun provideTokenCrypto(impl: TokenCryptoImpl): TokenCrypto = impl
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 567ddf8 and bdca6f8.

📒 Files selected for processing (23)
  • app/src/main/java/com/threegap/bitnagil/di/core/DataStoreModule.kt (1 hunks)
  • app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt (2 hunks)
  • app/src/main/java/com/threegap/bitnagil/di/core/Qualifier.kt (1 hunks)
  • app/src/main/java/com/threegap/bitnagil/di/core/SecurityModule.kt (2 hunks)
  • core/datastore/build.gradle.kts (0 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/crypto/TokenCrypto.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/model/AuthToken.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializer.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializerImpl.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenStorageFactory.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/di/DataStoreModule.kt (0 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/serializer/TokenSerializer.kt (0 hunks)
  • core/datastore/src/test/java/com/threegap/bitnagil/datastore/auth/serializer/AuthAuthTokenSerializerImplTest.kt (5 hunks)
  • core/datastore/src/test/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImplTest.kt (1 hunks)
  • core/network/build.gradle.kts (0 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt (1 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (1 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/token/TokenProvider.kt (1 hunks)
  • core/security/build.gradle.kts (0 hunks)
  • core/security/src/main/java/com/threegap/bitnagil/security/crypto/SecureCrypto.kt (1 hunks)
  • core/security/src/main/java/com/threegap/bitnagil/security/keystore/AndroidKeyProvider.kt (1 hunks)
💤 Files with no reviewable changes (5)
  • core/datastore/build.gradle.kts
  • core/security/build.gradle.kts
  • core/network/build.gradle.kts
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/serializer/TokenSerializer.kt
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/di/DataStoreModule.kt
🧰 Additional context used
🧠 Learnings (3)
app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt (1)
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#16
File: core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt:12-46
Timestamp: 2025-07-03T09:05:30.067Z
Learning: 이 프로젝트에서는 네트워크 모듈을 점진적으로 개발하고 있으며, TokenAuthenticator 같은 인증 관련 기능은 실제 API 연동 작업 시점에 NetworkModule에 연결할 예정입니다.
core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt (1)
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#16
File: core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt:12-46
Timestamp: 2025-07-03T09:05:30.067Z
Learning: 이 프로젝트에서는 네트워크 모듈을 점진적으로 개발하고 있으며, TokenAuthenticator 같은 인증 관련 기능은 실제 API 연동 작업 시점에 NetworkModule에 연결할 예정입니다.
core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (1)
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#16
File: core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt:12-46
Timestamp: 2025-07-03T09:05:30.067Z
Learning: 이 프로젝트에서는 네트워크 모듈을 점진적으로 개발하고 있으며, TokenAuthenticator 같은 인증 관련 기능은 실제 API 연동 작업 시점에 NetworkModule에 연결할 예정입니다.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (11)
app/src/main/java/com/threegap/bitnagil/di/core/Qualifier.kt (1)

1-1: 패키지 구조 변경이 적절합니다

DI 관련 파일들을 app 모듈의 di.core 패키지로 통합하여 중앙 집중식 관리를 구현하는 것이 순환 종속성 문제 해결에 적합합니다.

core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/model/AuthToken.kt (1)

1-1: 인증 관련 모델의 패키지 재구성이 적절합니다

인증 관련 클래스들을 auth 서브패키지로 그룹화하여 관심사 분리와 모듈화를 개선했습니다.

app/src/main/java/com/threegap/bitnagil/di/core/SecurityModule.kt (2)

1-1: DI 모듈의 중앙 집중화가 적절합니다

SecurityModule을 app 모듈로 이동하여 DI 생성 책임을 중앙화한 것은 순환 종속성 문제 해결에 효과적입니다.


16-16: 코드 가독성 개선

빈 줄 추가로 코드 가독성이 개선되었습니다.

core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt (1)

1-16: 패키지 이동 확인 완료

패키지 이동 외에 로직 변경 사항이 없으며, DI 재구성 의도와도 잘 맞습니다. 다른 모듈의 import-path 모두 업데이트되었는지 한 번 더 확인만 해주세요.

core/network/src/main/java/com/threegap/bitnagil/network/auth/AuthInterceptor.kt (1)

3-3: 네트워크 모듈의 데이터스토어 의존성 분리가 잘 구현되었습니다.

TokenProvider 인터페이스를 통한 추상화로 모듈 간 결합도가 효과적으로 감소되었습니다. 순환 종속성 문제 해결에 기여하는 좋은 설계 변경입니다.

Also applies to: 10-10, 14-14

app/src/main/java/com/threegap/bitnagil/di/core/NetworkModule.kt (1)

1-1: 패키지 구조 개선이 적절합니다.

DI 모듈을 di.core 패키지로 이동하여 모듈 구조가 더 명확해졌습니다.

core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt (1)

1-1: 패키지 구조 개선과 DI 책임 분리가 적절합니다.

데이터스토어 구현체를 auth.storage 패키지로 이동하고 @Inject 어노테이션을 제거하여 DI 책임을 app 모듈로 성공적으로 이관했습니다.

Also applies to: 5-5, 8-8

core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenStorageFactory.kt (1)

10-20: 팩토리 패턴을 활용한 DataStore 생성 로직이 우수합니다.

  • 암호화된 토큰 저장을 위한 적절한 파일명 사용 ("auth-token.enc")
  • ReplaceFileCorruptionHandler로 데이터 손상 시 안전한 복구 메커니즘 제공
  • 객체 생성 로직을 중앙화하여 유지보수성 향상

팩토리 패턴 적용으로 DI 구조가 더욱 명확해졌습니다.

core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/serializer/AuthTokenSerializerImpl.kt (1)

1-1: 시리얼라이저 리팩토링이 적절하게 수행되었습니다.

  • 표준 Serializer<AuthToken> 인터페이스 사용으로 일관성 향상
  • TokenCrypto 인터페이스 분리로 암호화 책임 명확화
  • @Inject 어노테이션 제거로 DI 책임 분리 완료

인터페이스 추상화와 네이밍이 더 명확해졌습니다.

Also applies to: 3-5, 13-15

app/src/main/java/com/threegap/bitnagil/di/core/DataStoreModule.kt (1)

29-34: DI 구성이 적절합니다!

Factory 패턴을 활용한 AuthTokenDataStore 생성이 깔끔하게 구현되었습니다. Context와 Serializer 의존성 주입도 올바르게 처리되었습니다.

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 a03e99d into develop Jul 6, 2025
2 checks passed
@wjdrjs00 wjdrjs00 deleted the refactor/#17-di-unification branch July 6, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 기존 기능 개선 🧤 대현

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] DI 구성 위치를 app 모듈로 이동

2 participants