-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] Statistics 관련 파트 Koin 전환 및 Hilt 의존 제거 #210 #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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 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. 📒 Files selected for processing (2)
WalkthroughHilt 의존성 주입 프레임워크에서 Koin으로 완전 마이그레이션. 빌드 설정에서 Hilt 플러그인 제거, Koin 라이브러리 추가, 모든 ViewModel 및 저장소에서 Hilt 애너테이션 제거, Koin 모듈 및 기본 설정 추가 완료. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this 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으로 제공해야 합니다. 현재HomeScreen과NavGraph에서는 여전히 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
📒 Files selected for processing (8)
app/build.gradle.ktsapp/src/main/java/com/konkuk/medicarecall/App.ktapp/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.ktapp/src/main/java/com/konkuk/medicarecall/data/repositoryimpl/StatisticsRepositoryImpl.ktapp/src/main/java/com/konkuk/medicarecall/ui/feature/home/viewmodel/HomeViewModel.ktapp/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/screen/StatisticsScreen.ktapp/src/main/java/com/konkuk/medicarecall/ui/feature/statistics/viewmodel/StatisticsViewModel.ktbuild.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을 통해 적절히 제공되며, 비즈니스 로직은 변경 없이 유지되었습니다.
| import javax.inject.Inject | ||
|
|
||
| @HiltAndroidApp | ||
| class App : Application() { | ||
| @Inject | ||
| lateinit var fcmRepository: FcmRepository | ||
|
|
||
| private val fcmRepository: FcmRepository by inject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
fd "App\.kt" --type fRepository: Medicare-Call/Medicare-Call-Android
Length of output: 127
🏁 Script executed:
cat -n app/src/main/java/com/konkuk/medicarecall/App.ktRepository: Medicare-Call/Medicare-Call-Android
Length of output: 4401
🏁 Script executed:
rg "FcmRepository" --type kotlin -A 3 -B 1Repository: Medicare-Call/Medicare-Call-Android
Length of output: 11830
🏁 Script executed:
rg "javax\.inject\.Inject" --type kotlin -A 2 -B 1Repository: Medicare-Call/Medicare-Call-Android
Length of output: 21155
🏁 Script executed:
fd "Module\.kt" --type f | head -20Repository: Medicare-Call/Medicare-Call-Android
Length of output: 348
🏁 Script executed:
cat -n app/src/main/java/com/konkuk/medicarecall/data/di/StatisticsModule.ktRepository: 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 2Repository: Medicare-Call/Medicare-Call-Android
Length of output: 8001
Line 20의 미사용 import 제거 필요 및 DI 프레임워크 불일치 문제
-
javax.inject.Injectimport는 사용되지 않습니다. Koin의by inject()를 사용하므로 제거하세요. -
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.
| 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.
| 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()) } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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 -10Repository: 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 kotlinRepository: 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.
ikseong00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
librawish808
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
🔗 관련 이슈
📙 작업 설명
📸 스크린샷 또는 시연 영상 (선택)
💬 추가 설명 or 리뷰 포인트 (선택)
Summary by CodeRabbit
리팩토링
이번 업데이트는 기술적 기반을 강화하여 더욱 안정적인 앱 운영을 지원합니다.
✏️ Tip: You can customize this high-level summary in your review settings.