koin, resolve reviewed suggestions

This commit is contained in:
CorneilleEdi
2020-02-05 07:22:52 +05:30
parent 5fad99827d
commit cf1835ad44
5 changed files with 13 additions and 11 deletions

4
.gitignore vendored
View File

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

View File

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

View File

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

View File

@ -19,9 +19,8 @@ class App : Application() {
private fun configureDI() = startKoin {
androidContext(this@App)
modules(provideComponent())
modules(appComponent)
}
private fun provideComponent() = appComponent
}

View File

@ -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>()
}
}