Skip to content

Commit 2d038cb

Browse files
authored
Merge pull request #3 from CGreenP/dev
feat: Add dependency injection and application class
2 parents 9eb5b4e + c961c0f commit 2d038cb

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<uses-permission android:name="android.permission.INTERNET" />
66

77
<application
8+
android:name=".TechExactlyApplication"
89
android:allowBackup="true"
910
android:dataExtractionRules="@xml/data_extraction_rules"
1011
android:fullBackupContent="@xml/backup_rules"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.example.techexactly
2+
3+
import android.app.Application
4+
import com.example.techexactly.di.appModule
5+
import org.koin.android.ext.koin.androidContext
6+
import org.koin.core.context.startKoin
7+
8+
class TechExactlyApplication : Application() {
9+
override fun onCreate() {
10+
super.onCreate()
11+
startKoin {
12+
androidContext(this@TechExactlyApplication)
13+
modules(appModule)
14+
}
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.techexactly.di
2+
3+
import com.example.techexactly.model.network.provideRetrofit
4+
import com.example.techexactly.model.network.provideUserApi
5+
import com.example.techexactly.model.repository.UserRepository
6+
import org.koin.dsl.module
7+
8+
val appModule = module {
9+
single { provideRetrofit() }
10+
single { provideUserApi(get()) }
11+
single { UserRepository(get()) }
12+
}

0 commit comments

Comments
 (0)