mirror of
https://github.com/mrcsxsiq/Kotlin-Pokedex.git
synced 2025-05-17 05:15:53 +08:00
koin, resolve reviewed suggestions
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -49,6 +49,10 @@ captures/
|
||||
.idea/modules.xml
|
||||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||
.idea/navEditor.xml
|
||||
.idea/codeStyles/Project.xml
|
||||
.idea/codeStyles/codeStyleConfig.xml
|
||||
.idea/misc.xml
|
||||
.idea/runConfigurations.xml
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||
|
@ -62,8 +62,8 @@ Also available in Play Store
|
||||
- [x] Offline Persistence with Room
|
||||
- [x] Databinding
|
||||
- [ ] ~[Jetpack Compose](https://github.com/mrcsxsiq/Kotlin-Pokedex/issues/4)~ - See [compose-pokedex](https://github.com/zsoltk/compose-pokedex)
|
||||
- [x] Coroutines
|
||||
- [ ] Koin
|
||||
- [ ] Coroutines
|
||||
- [x] Koin
|
||||
- [ ] JUnit
|
||||
- [ ] MotionLayout
|
||||
- [ ] Transition Animations
|
||||
|
@ -55,11 +55,11 @@ dependencies {
|
||||
|
||||
// DI
|
||||
// Koin for Android
|
||||
implementation "org.koin:koin-android:2.0.1"
|
||||
implementation 'org.koin:koin-android:2.0.1'
|
||||
// or Koin for Lifecycle scoping
|
||||
implementation "org.koin:koin-androidx-scope:2.0.1"
|
||||
implementation 'org.koin:koin-androidx-scope:2.0.1'
|
||||
// or Koin for Android Architecture ViewModel
|
||||
implementation "org.koin:koin-androidx-viewmodel:2.0.1"
|
||||
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
|
@ -19,9 +19,8 @@ class App : Application() {
|
||||
|
||||
private fun configureDI() = startKoin {
|
||||
androidContext(this@App)
|
||||
modules(provideComponent())
|
||||
modules(appComponent)
|
||||
}
|
||||
|
||||
private fun provideComponent() = appComponent
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import dev.marcosfarias.pokedex.repository.PokemonService
|
||||
import org.koin.dsl.module
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import retrofit2.create
|
||||
|
||||
val networkModule = module {
|
||||
single<Retrofit> {
|
||||
@ -13,9 +14,7 @@ val networkModule = module {
|
||||
.build()
|
||||
}
|
||||
|
||||
factory<PokemonService> {
|
||||
get<Retrofit>().create(
|
||||
PokemonService::class.java
|
||||
)
|
||||
single {
|
||||
get<Retrofit>().create<PokemonService>()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user