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