Skip to content

Conversation

@alswlekk
Copy link
Collaborator

@alswlekk alswlekk commented Jan 3, 2026

🔗 관련 이슈

📙 작업 설명

  • 주간통계와 관련된 부분에서 쓰인 hilt를 koin으로 리펙토링 진행
  • 뷰모델에서 inject, hilt 관련 어노테이션 제거

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

기능 미리보기 기능 미리보기
기능 설명 기능 설명

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

Summary by CodeRabbit

리팩토링

  • 애플리케이션 내부 아키텍처 시스템 업그레이드 완료
  • 의존성 관리 인프라 최적화로 애플리케이션 안정성 및 성능 개선
  • 통계 기능 모듈 구조 정비

이번 업데이트는 기술적 기반을 강화하여 더욱 안정적인 앱 운영을 지원합니다.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 3, 2026

Warning

Rate limit exceeded

@alswlekk has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 22 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d09bf24 and c3a1451.

📒 Files selected for processing (2)
  • app/src/main/java/com/konkuk/medicarecall/App.kt
  • app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt

Walkthrough

Hilt 의존성 주입 프레임워크에서 Koin으로 완전 마이그레이션. 빌드 설정에서 Hilt 플러그인 제거, Koin 라이브러리 추가, 모든 ViewModel 및 저장소에서 Hilt 애너테이션 제거, Koin 모듈 및 기본 설정 추가 완료.

Changes

Cohort / File(s) 설명
빌드 설정 마이그레이션
build.gradle.kts, app/build.gradle.kts
Hilt 플러그인 제거 및 Koin 코어, 안드로이드, Compose 의존성 추가
애플리케이션 초기화
app/src/main/java/com/konkuk/medicarecall/App.kt
@HiltAndroidApp 제거, Koin startKoin() 초기화 추가, FcmRepository를 Koin 주입으로 변경
DI 모듈 설정
app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt
새로운 Koin 모듈 추가: StatisticsService, StatisticsRepository, StatisticsViewModel 바인딩
ViewModel 및 저장소 선언
app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/viewmodel/StatisticsViewModel.kt, app/src/main/java/com/konkuk/medicarecall/ui/feature/home/viewmodel/HomeViewModel.kt, app/src/main/java/com/konkuk/medicarecall/data/repositoryimpl/StatisticsRepositoryImpl.kt
@HiltViewModel, @Inject 애너테이션 모두 제거
화면 계층 업데이트
app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/screen/StatisticsScreen.kt
hiltViewModel()koinViewModel() 변경, statisticsViewModel.refresh() 호출 추가

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ikseong00

Poem

🔧 Hilt에서 Koin으로 부드럽게 전환
주입이 다시 흐르고, 설정이 깔끔해져
KMP의 길을 열며
모듈 하나 추가, DI는 완성
마이그레이션, 이제 끝! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed PR이 #210의 Hilt→Koin 마이그레이션 목표 중 '설정' 및 '통계' 관련 부분을 성공적으로 구현했습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 Hilt 제거 및 Koin 도입이라는 범위 내에 있으며, 추가적인 비관련 변경은 없습니다.
Title check ✅ Passed 풀 리퀘스트 제목이 변경 사항의 주요 목적을 명확하게 반영하고 있으며, 통계 부분의 Koin 전환과 Hilt 의존 제거라는 핵심 변경 사항을 정확히 요약하고 있습니다.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

@alswlekk alswlekk self-assigned this Jan 3, 2026
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/src/main/java/com/konkuk/medicarecall/ui/feature/home/viewmodel/HomeViewModel.kt (1)

26-32: 빈 줄 정리 필요: 연속된 빈 줄 제거

파이프라인 오류 NoConsecutiveBlankLines 수정이 필요합니다. 클래스 선언 전 연속된 빈 줄을 하나로 정리해주세요.

HomeViewModel Koin 등록 필요

StatisticsScreen에서 koinViewModel()로 주입받도록 설정되어 있지만, HomeViewModel이 Koin 모듈에 등록되지 않았습니다. StatisticsModule 또는 새로운 모듈에 HomeViewModel을 등록하거나, 생성자에서 필요한 의존성들을 Koin으로 제공해야 합니다. 현재 HomeScreenNavGraph에서는 여전히 Hilt를 사용하고 있어서 DI 전략이 혼재되어 있습니다.

🧹 Nitpick comments (1)
app/build.gradle.kts (1)

109-112: Koin 의존성 추가 확인됨

Hilt에서 Koin으로의 마이그레이션이 올바르게 진행되었습니다. 다만 다른 라이브러리들(예: libs.hilt.android)처럼 버전 카탈로그를 사용하면 버전 관리가 더 일관성 있게 유지됩니다.

🔎 버전 카탈로그 사용 제안

libs.versions.toml에 Koin 버전을 추가하고 참조하는 방식을 고려해보세요:

# libs.versions.toml
[versions]
koin = "3.5.3"

[libraries]
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin" }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50931f0 and d09bf24.

📒 Files selected for processing (8)
  • app/build.gradle.kts
  • app/src/main/java/com/konkuk/medicarecall/App.kt
  • app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt
  • app/src/main/java/com/konkuk/medicarecall/data/repositoryimpl/StatisticsRepositoryImpl.kt
  • app/src/main/java/com/konkuk/medicarecall/ui/feature/home/viewmodel/HomeViewModel.kt
  • app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/screen/StatisticsScreen.kt
  • app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/viewmodel/StatisticsViewModel.kt
  • build.gradle.kts
💤 Files with no reviewable changes (1)
  • build.gradle.kts
🧰 Additional context used
🪛 GitHub Actions: Android CI
app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt

[error] 23-23: NoConsecutiveBlankLines: Needless blank line(s)

app/src/main/java/com/konkuk/medicarecall/App.kt

[error] 36-36: Missing trailing comma before ")" [TrailingCommaOnCallSite]


[error] 20-20: NoUnusedImports: Unused import

app/src/main/java/com/konkuk/medicarecall/ui/feature/home/viewmodel/HomeViewModel.kt

[error] 26-26: NoConsecutiveBlankLines: Needless blank line(s)

🔇 Additional comments (3)
app/src/main/java/com/konkuk/medicarecall/data/repositoryimpl/StatisticsRepositoryImpl.kt (1)

17-20: LGTM!

Hilt의 @Inject 어노테이션이 올바르게 제거되었고, StatisticsModule에서 Koin으로 적절히 제공됩니다. 구현 로직은 변경 없이 유지되었습니다.

app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/screen/StatisticsScreen.kt (1)

60-61: koinViewModel() 마이그레이션 확인됨

hiltViewModel()에서 koinViewModel()로의 전환이 올바르게 이루어졌습니다. 단, HomeViewModel이 Koin 모듈에 등록되어 있어야 정상 동작합니다. StatisticsModule에는 StatisticsViewModel만 등록되어 있으므로, HomeViewModel 등록 여부를 확인해주세요.

app/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/viewmodel/StatisticsViewModel.kt (1)

26-29: LGTM!

Hilt 어노테이션(@HiltViewModel, @Inject)이 올바르게 제거되었습니다. StatisticsModule에서 Koin을 통해 적절히 제공되며, 비즈니스 로직은 변경 없이 유지되었습니다.

Comment on lines 20 to 24
import javax.inject.Inject

@HiltAndroidApp
class App : Application() {
@Inject
lateinit var fcmRepository: FcmRepository

private val fcmRepository: FcmRepository by inject()
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

fd "App\.kt" --type f

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 127


🏁 Script executed:

cat -n app/src/main/java/com/konkuk/medicarecall/App.kt

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 4401


🏁 Script executed:

rg "FcmRepository" --type kotlin -A 3 -B 1

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 11830


🏁 Script executed:

rg "javax\.inject\.Inject" --type kotlin -A 2 -B 1

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 21155


🏁 Script executed:

fd "Module\.kt" --type f | head -20

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 348


🏁 Script executed:

cat -n app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 1077


🏁 Script executed:

rg "single|factory|bind" app/src/main/java/com/konkuk/medicarecall/data/di/ --type kotlin -A 2

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 8001


Line 20의 미사용 import 제거 필요 및 DI 프레임워크 불일치 문제

  1. javax.inject.Inject import는 사용되지 않습니다. Koin의 by inject()를 사용하므로 제거하세요.

  2. FcmRepository가 Koin의 by inject()로 주입되지만, Koin 모듈 설정이 누락되어 있습니다. StatisticsModule에는 FcmRepository가 등록되어 있지 않으며, 실제 등록은 Hilt의 RepositoryModule에만 있습니다. 이는 런타임에 NoBeanDefFoundException을 유발합니다.

현재 코드는 Hilt(RepositoryModule)와 Koin(App.kt, StatisticsModule)을 혼용하고 있어 DI 프레임워크가 불일치합니다. App.kt에서 Koin을 사용한다면, FcmRepository를 Koin 모듈에 등록하거나 Hilt로 통합해야 합니다.

수정 제안
-import javax.inject.Inject

그리고 FcmRepository를 Koin 모듈에 등록하거나, App.kt에서 Hilt를 사용하도록 변경하세요.

📝 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
import javax.inject.Inject
@HiltAndroidApp
class App : Application() {
@Inject
lateinit var fcmRepository: FcmRepository
private val fcmRepository: FcmRepository by inject()
class App : Application() {
private val fcmRepository: FcmRepository by inject()
🧰 Tools
🪛 GitHub Actions: Android CI

[error] 20-20: NoUnusedImports: Unused import

🤖 Prompt for AI Agents
In app/src/main/java/com/konkuk/medicarecall/App.kt around lines 20 to 24,
remove the unused import javax.inject.Inject and resolve the DI mismatch: either
register FcmRepository in your Koin modules and ensure App starts Koin with that
module (e.g., add a Koin single/bind for FcmRepository in StatisticsModule or a
new module and include it in startKoin), or stop using Koin here and convert App
to use Hilt (apply Hilt annotations and initialize Hilt in Application) so the
repository is provided by the same DI framework; do one of these two fixes
(remove import + add Koin binding for FcmRepository and include the module at
startup, or refactor App to Hilt) to prevent NoBeanDefFoundException.

Comment on lines 12 to 21
val statisticsModule = module {
// API Service
single { get<Retrofit>().create(StatisticsService::class.java) }

// Repository
single<StatisticsRepository> { StatisticsRepositoryImpl(get<StatisticsService>(), get<EldersHealthInfoRepository>()) }

// ViewModel
viewModel { StatisticsViewModel(get(), get()) }
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for Retrofit registration in Koin modules
echo "=== Checking Retrofit registration ==="
rg -n "single.*Retrofit|Retrofit\.Builder|get<Retrofit>" --type kotlin

echo ""
echo "=== Checking EldersHealthInfoRepository registration ==="
rg -n "single.*EldersHealthInfoRepository|get<EldersHealthInfoRepository>" --type kotlin

echo ""
echo "=== Checking all Module.kt files ==="
find . -name "*Module.kt" -type f | head -20

echo ""
echo "=== Checking StatisticsModule.kt directly ==="
find . -path "*/data/di/StatisticsModule.kt" -exec wc -l {} \; -exec cat -n {} \;

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 2158


🏁 Script executed:

#!/bin/bash
# Check NetworkModule.kt for Retrofit single registration
echo "=== NetworkModule.kt content (showing Retrofit registration context) ==="
sed -n '70,90p' app/src/main/java/com/konkuk/medicarecall/data/di/NetworkModule.kt

echo ""
echo "=== Checking for Retrofit single registration in NetworkModule ==="
rg -A 5 -B 5 "single.*Retrofit|@Provides" app/src/main/java/com/konkuk/medicarecall/data/di/NetworkModule.kt | head -30

echo ""
echo "=== RepositoryModule.kt content ==="
cat -n app/src/main/java/com/konkuk/medicarecall/data/di/RepositoryModule.kt

echo ""
echo "=== Searching for HomeViewModel registration ==="
rg -n "HomeViewModel|viewModel" --type kotlin app/src/main/java/com/konkuk/medicarecall/data/di/

echo ""
echo "=== Checking if Koin modules are loaded together ==="
rg -n "listOf.*Module|modules.*Module" --type kotlin | head -10

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 9425


🏁 Script executed:

#!/bin/bash
# Check ApiModule.kt
echo "=== ApiModule.kt content ==="
cat -n app/src/main/java/com/konkuk/medicarecall/data/di/ApiModule.kt

echo ""
echo "=== Searching for Koin initialization ==="
rg -n "startKoin|modules.*Module|@Module.*Koin" --type kotlin | head -20

echo ""
echo "=== Checking for any Hilt modules including Koin ==="
rg -n "class.*Module|object.*Module" app/src/main/java/com/konkuk/medicarecall/data/di/ --type kotlin

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 6600


🏁 Script executed:

#!/bin/bash
# Check App.kt to see how Koin is initialized and configured
echo "=== App.kt Koin initialization ==="
cat -n app/src/main/java/com/konkuk/medicarecall/App.kt

echo ""
echo "=== Check if StatisticsService is registered in Koin ==="
rg -n "StatisticsService" --type kotlin app/src/main/java/com/konkuk/medicarecall/data/di/

Repository: Medicare-Call/Medicare-Call-Android

Length of output: 5370


Koin과 Hilt 간의 의존성 주입 프레임워크 충돌

StatisticsModule에서 get<Retrofit>()get<EldersHealthInfoRepository>()를 통해 의존성을 주입하려 하지만, 이 두 의존성은 Hilt 컨테이너에 등록되어 있습니다. Koin의 get<T>()은 Hilt 컨테이너에 접근할 수 없으므로 런타임에 NoBeanDefFoundException이 발생합니다.

StatisticsModule을 다음 중 하나로 수정하세요:

  • Hilt 기반으로 변환 (@module @Installin @provides 사용)
  • 또는 필요한 의존성을 Koin 설정에 추가
  • 또는 Hilt 기반의 생성자 주입으로 변경

추가로, App.kt에서 FcmRepository도 Koin의 inject()로 주입 중인데, 이것도 동일한 문제가 발생합니다 (FcmRepository는 Hilt에만 등록됨).

🤖 Prompt for AI Agents
In app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.kt around
lines 12 to 21, Koin's get<T>() is being used to resolve Retrofit and
EldersHealthInfoRepository which are registered in Hilt, causing runtime
NoBeanDefFoundException; update this by either (A) converting this Koin module
to Hilt (@Module + @InstallIn and @Provides/@Binds or constructor-injecting
StatisticsRepositoryImpl and StatisticsViewModel), or (B) register Retrofit and
EldersHealthInfoRepository (and any other Hilt-only bindings like FcmRepository
used in App.kt) into the Koin application so get<T>() resolves, or (C) remove
Koin usage and switch to Hilt constructor injection for the repository and
ViewModel; pick one approach and make matching changes for App.kt where
FcmRepository is injected so all DI uses the same container.

@alswlekk alswlekk changed the title [Refactor] Setting 관련 파트 Koin 전환 및 Hilt 의존 제거 #210 [Refactor] Statistics 관련 파트 Koin 전환 및 Hilt 의존 제거 #210 Jan 3, 2026
Copy link
Contributor

@ikseong00 ikseong00 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

@librawish808 librawish808 left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] KMP 전환을 위한 Hilt -> Koin 마이그레이션

4 participants