Skip to content

Conversation

@tristanjung1006
Copy link
Contributor

@tristanjung1006 tristanjung1006 commented Dec 28, 2025

Phase 1: Hilt 완전 적용

  • NetworkModule에 누락된 서비스 추가 (Create, Social, Notice, Record, FCM)
  • 모든 Repository에 @Inject @singleton 적용
  • 모든 ViewModel을 @hiltviewmodel 패턴으로 마이그레이션
  • ViewModelFactory 클래스 삭제 (7개 파일)
  • 모든 Fragment에 @androidentrypoint 적용 (30+ 파일)
  • Fragment에서 by viewModels() 델리게이트 사용으로 전환

Phase 2: 멀티 모듈 구조 설정

  • build-logic Convention Plugins 생성
  • Version Catalog (libs.versions.toml) 추가
  • Core 모듈 생성: common, network, datastore, domain, data, designsystem
  • Feature 모듈 생성: home, social, record, mypage, onboarding, create, notice
  • app 모듈에 core 모듈 의존성 연결

버그 수정

  • CreateService.kt 패키지명 오타 수정
  • google-services.json 패키지명 오타 수정
  • SigningConfig storeFile 누락 시 기본값 사용하도록 수정

Summary by CodeRabbit

릴리스 노트

  • Chores
    • 의존성 주입 시스템(Hilt) 전면 적용으로 코드 구조 개선
    • 모듈 아키텍처 재구성(Core, Feature 모듈 분리)
    • Gradle 빌드 시스템 업그레이드 및 버전 카탈로그 도입
    • AndroidX, Firebase, Room 등 주요 라이브러리 버전 업데이트
    • 프로젝트 구성 최적화로 유지보수성 향상

✏️ Tip: You can customize this high-level summary in your review settings.

  Phase 1: Hilt 완전 적용
  - NetworkModule에 누락된 서비스 추가 (Create, Social, Notice, Record, FCM)
  - 모든 Repository에 @Inject @singleton 적용
  - 모든 ViewModel을 @hiltviewmodel 패턴으로 마이그레이션
  - ViewModelFactory 클래스 삭제 (7개 파일)
  - 모든 Fragment에 @androidentrypoint 적용 (30+ 파일)
  - Fragment에서 by viewModels() 델리게이트 사용으로 전환

  Phase 2: 멀티 모듈 구조 설정
  - build-logic Convention Plugins 생성
  - Version Catalog (libs.versions.toml) 추가
  - Core 모듈 생성: common, network, datastore, domain, data, designsystem
  - Feature 모듈 생성: home, social, record, mypage, onboarding, create, notice
  - app 모듈에 core 모듈 의존성 연결

  버그 수정
  - CreateService.kt 패키지명 오타 수정
  - google-services.json 패키지명 오타 수정
  - SigningConfig storeFile 누락 시 기본값 사용하도록 수정
@tristanjung1006 tristanjung1006 self-assigned this Dec 28, 2025
@tristanjung1006 tristanjung1006 added the ♻️ refactor 코드 개선 label Dec 28, 2025
@tristanjung1006 tristanjung1006 merged commit df4073e into master Dec 28, 2025
3 of 4 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

Caution

Review failed

The pull request is closed.

개요

이 PR은 Android 프로젝트를 다중 모듈 아키텍처로 재구성하고 Hilt 기반 의존성 주입(DI)으로 마이그레이션합니다. 새로운 build-logic 컨벤션 플러그인, corefeature 모듈을 도입하며 수동 ViewModelFactory 패턴을 제거하고 대규모로 DI를 적용합니다.

변경 사항

응집도 / 파일 요약
모듈 구조 및 빌드 설정
settings.gradle.kts, build-logic/*, core/*, feature/*
새로운 다중 모듈 아키텍처 도입. build-logic 컨벤션 플러그인(Android Application/Library/Hilt/Feature/Compose) 및 5개 코어 모듈(common, network, datastore, domain, data, designsystem)과 7개 기능 모듈(home, social, record, mypage, onboarding, create, notice) 추가. gradle/libs.versions.toml로 의존성 버전 관리 중앙화.
Hilt DI 마이그레이션 - ViewModels
app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/*.kt
ViewModels에 @HiltViewModel@Inject constructor 추가. CardViewModel, UserViewModel, SocialViewModel, NoticeViewModel 등 10개 이상의 ViewModels 수정. 모든 legacy ViewModelFactory 클래스(CardViewModelFactory, LoginViewModelFactory, RecordViewModelFactory 등) 제거.
Hilt DI 마이그레이션 - Fragments
app/src/main/java/com/toyou/toyouandroid/presentation/fragment/*/*.kt
30개 이상의 Fragment에 @AndroidEntryPoint 추가. lateinit var ViewModel을 activityViewModels()/viewModels() 위임 속성으로 변경. 모든 수동 token/service/repository 초기화 제거.
DI 모듈 및 Repository
app/src/main/java/com/toyou/toyouandroid/di/*.kt, app/src/main/java/com/toyou/toyouandroid/domain/*/*.kt
NetworkModule에 5개 서비스 제공자 추가(CreateService, SocialService, NoticeService, RecordService, FCMService). RepositoryModule 비워짐. CreateRepository, NoticeRepository, ProfileRepository, RecordRepository, SocialRepository, FCMRepository에 @Singleton@Inject 추가.
핵심 모듈 - 도메인 및 모델
core/domain/src/main/kotlin/com/toyou/core/domain/*
새로운 도메인 모델(Card, Question, Friend, Notice, User) 및 repository 인터페이스(HomeRepository, NoticeRepository, SocialRepository) 도입.
핵심 모듈 - 네트워크 및 저장소
core/network/*, core/datastore/*
NetworkClient 싱글톤으로 Retrofit 클라이언트 관리. TokenStorage, TutorialStorage, UserPreferences로 SharedPreferences 캡슐화. core/common에 Result 봉인 인터페이스 및 확장 함수 추가.
핵심 모듈 - 디자인 시스템
core/designsystem/*
Jetpack Compose 색상(Color.kt), 타이포그래피(Type.kt), 테마(Theme.kt) 정의.
앱 의존성 및 서명
app/build.gradle.kts
코어 모듈 의존성(core:common, core:network, core:datastore, core:domain, core:data, core:designsystem) 추가. Hilt, Room, Firebase, Kakao, Retrofit, OkHttp 업그레이드/정리. 디버그 서명을 SIGNED_STORE_FILE 존재 시에만 조건부로 설정.
IDE 및 Project 설정
.idea/compiler.xml, .idea/gradle.xml, .idea/kotlinc.xml, .idea/appInsightsSettings.xml, .gitignore
bytecodeTargetLevel 단순화(21로 통일). Gradle composite build 및 확장된 모듈 목록 추가. Kotlin 플러그인 버전 1.8.20으로 업데이트. Android Vitals 앱 ID 변경(com.toyou.toyouandroid로). 빌드 디렉토리 무시 패턴 확장.

시퀀스 다이어그램

sequenceDiagram
    participant Fragment
    participant Hilt as Hilt/DI Container
    participant ViewModel as ViewModel<br/>(HiltViewModel)
    participant Repository as Repository<br/>(`@Singleton`)
    participant Service as Network Service<br/>(Retrofit)
    participant NetworkClient as NetworkClient

    Fragment->>Hilt: `@AndroidEntryPoint`<br/>by activityViewModels()
    Hilt->>ViewModel: `@HiltViewModel` 생성<br/>의존성 주입
    ViewModel->>Hilt: Repository 요청
    Hilt->>Repository: `@Singleton`<br/>@Inject constructor
    Repository->>Hilt: Service 요청
    Hilt->>Service: `@Provides` 메서드<br/>@AuthRetrofit Retrofit
    Service->>NetworkClient: getAuthClient()
    NetworkClient-->>Service: Retrofit 인스턴스
    Service-->>Repository: 네트워크 호출
    Repository-->>ViewModel: Result<T> 반환
    ViewModel-->>Fragment: LiveData/StateFlow 업데이트
Loading

예상 코드 리뷰 노력

🎯 4 (복잡) | ⏱️ ~45분

관련 가능성이 있는 PR

  • Release/1.1.0 #111: 앱 빌드 설정의 서명 설정 변경(SIGNED_STORE_FILE 조건부 처리) 관련.
  • Refactor/#117 mypage #118: Hilt/DI 마이그레이션, NetworkModule/Qualifier, .idea/compiler.xml, RepositoryModule 편집에서 직접 코드 겹침.

추천 검토자

  • jeong724
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#119

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abdb1d6 and 2bc6b7d.

📒 Files selected for processing (129)
  • .gitignore
  • .idea/appInsightsSettings.xml
  • .idea/compiler.xml
  • .idea/gradle.xml
  • .idea/kotlinc.xml
  • app/build.gradle.kts
  • app/src/main/java/com/toyou/toyouandroid/data/create/service/CreateService.kt
  • app/src/main/java/com/toyou/toyouandroid/di/NetworkModule.kt
  • app/src/main/java/com/toyou/toyouandroid/di/RepositoryModule.kt
  • app/src/main/java/com/toyou/toyouandroid/domain/create/repository/CreateRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/domain/notice/NoticeRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/domain/profile/repository/ProfileRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/domain/record/RecordRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/domain/social/repostitory/SocialRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/fcm/domain/FCMRepository.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeOptionFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/emotionstamp/HomeResultFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/CardFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/CreateFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/CreateWriteFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/HomeFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/ModifyFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/home/PreviewFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/MypageDialogViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/NoticeSettingFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/mypage/ProfileFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeDialogViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/notice/NoticeViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/LoginViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupAgreeViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupNicknameFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SignupStatusViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/onboarding/SplashFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/CalendarDialogViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/CardInfoViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/RecordFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/CalendarFriendRecordFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardContainerFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardDetailFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendCardViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/friend/FriendRecordViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/CalendarMyRecordFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardContainerFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardDetailFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyCardViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/record/my/MyRecordViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/CustomDialogFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/QuestionContentFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/QuestionContentLongFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/QuestionTypeFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SendFinalFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SendFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/social/SocialFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialFragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialStep1Fragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialStep2Fragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialStep3Fragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialStep4Fragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/fragment/tutorial/TutorialStep5Fragment.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/CardViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/CardViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/HomeViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/LoginViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/NoticeViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/RecordViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/SocialViewModelFactory.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/UserViewModel.kt
  • app/src/main/java/com/toyou/toyouandroid/presentation/viewmodel/UserViewModelFactory.kt
  • build-logic/convention/build.gradle.kts
  • build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidComposeConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidHiltConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt
  • build-logic/convention/src/main/kotlin/KotlinAndroid.kt
  • build-logic/settings.gradle.kts
  • core/common/build.gradle.kts
  • core/common/src/main/AndroidManifest.xml
  • core/common/src/main/kotlin/com/toyou/core/common/di/DispatcherModule.kt
  • core/common/src/main/kotlin/com/toyou/core/common/result/Result.kt
  • core/data/build.gradle.kts
  • core/data/src/main/AndroidManifest.xml
  • core/data/src/main/kotlin/com/toyou/core/data/di/DataModule.kt
  • core/datastore/build.gradle.kts
  • core/datastore/src/main/AndroidManifest.xml
  • core/datastore/src/main/kotlin/com/toyou/core/datastore/TokenStorage.kt
  • core/datastore/src/main/kotlin/com/toyou/core/datastore/TutorialStorage.kt
  • core/datastore/src/main/kotlin/com/toyou/core/datastore/UserPreferences.kt
  • core/designsystem/build.gradle.kts
  • core/designsystem/src/main/AndroidManifest.xml
  • core/designsystem/src/main/kotlin/com/toyou/core/designsystem/theme/Color.kt
  • core/designsystem/src/main/kotlin/com/toyou/core/designsystem/theme/Theme.kt
  • core/designsystem/src/main/kotlin/com/toyou/core/designsystem/theme/Type.kt
  • core/domain/build.gradle.kts
  • core/domain/src/main/AndroidManifest.xml
  • core/domain/src/main/kotlin/com/toyou/core/domain/model/Card.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/model/Friend.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/model/Notice.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/model/User.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/repository/HomeRepository.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/repository/NoticeRepository.kt
  • core/domain/src/main/kotlin/com/toyou/core/domain/repository/SocialRepository.kt
  • core/network/build.gradle.kts
  • core/network/src/main/AndroidManifest.xml
  • core/network/src/main/kotlin/com/toyou/core/network/NetworkClient.kt
  • core/network/src/main/kotlin/com/toyou/core/network/di/NetworkModule.kt
  • core/network/src/main/kotlin/com/toyou/core/network/model/BaseResponse.kt
  • feature/create/build.gradle.kts
  • feature/create/src/main/AndroidManifest.xml
  • feature/home/build.gradle.kts
  • feature/home/src/main/AndroidManifest.xml
  • feature/mypage/build.gradle.kts
  • feature/mypage/src/main/AndroidManifest.xml
  • feature/notice/build.gradle.kts
  • feature/notice/src/main/AndroidManifest.xml
  • feature/onboarding/build.gradle.kts
  • feature/onboarding/src/main/AndroidManifest.xml
  • feature/record/build.gradle.kts
  • feature/record/src/main/AndroidManifest.xml
  • feature/social/build.gradle.kts
  • feature/social/src/main/AndroidManifest.xml
  • gradle/libs.versions.toml
  • gradlew
  • settings.gradle.kts

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

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

@sonarqubecloud
Copy link

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.

2 participants