From 64a96453552118d212dc98e25ace32c4b785c646 Mon Sep 17 00:00:00 2001 From: "babichev.a" Date: Fri, 25 Oct 2024 22:45:17 +0400 Subject: [PATCH] migration to koin 4.0 --- android-compose-app/build.gradle.kts | 1 + desktop-compose-app/build.gradle.kts | 3 +- gradle/libs.versions.toml | 15 ++++---- ios-compose-kit/build.gradle.kts | 2 + jvm-compose-test/build.gradle.kts | 3 +- shared-compose-ui/build.gradle.kts | 6 ++- .../softartdev/notedelight/di/androidKoin.kt | 8 ---- .../kotlin/com/softartdev/notedelight/App.kt | 24 ++++++------ .../softartdev/notedelight/di/commonKoin.kt | 7 ---- .../softartdev/notedelight/di/getViewModel.kt | 15 -------- .../com/softartdev/notedelight/di/jvmKoin.kt | 9 ----- shared/build.gradle.kts | 25 ++++++------ .../notedelight/shared/di/androidExt.kt | 14 ------- .../notedelight/shared/di/androidModules.kt | 4 +- .../notedelight/shared/di/commonExt.kt | 13 ------- .../notedelight/shared/di/sharedModules.kt | 38 ++++++++++--------- .../notedelight/shared/di/iosExt.kt | 13 ------- .../notedelight/shared/di/iosModules.kt | 4 +- .../notedelight/shared/di/jvmExt.kt | 13 ------- .../notedelight/shared/di/jvmModules.kt | 4 +- 20 files changed, 74 insertions(+), 147 deletions(-) delete mode 100644 shared-compose-ui/src/androidMain/kotlin/com/softartdev/notedelight/di/androidKoin.kt delete mode 100644 shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/di/commonKoin.kt delete mode 100644 shared-compose-ui/src/iosMain/kotlin/com/softartdev/notedelight/di/getViewModel.kt delete mode 100644 shared-compose-ui/src/jvmMain/kotlin/com/softartdev/notedelight/di/jvmKoin.kt delete mode 100644 shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidExt.kt delete mode 100644 shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/commonExt.kt delete mode 100644 shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosExt.kt delete mode 100644 shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmExt.kt diff --git a/android-compose-app/build.gradle.kts b/android-compose-app/build.gradle.kts index 1a34c3f3..08ca9bce 100644 --- a/android-compose-app/build.gradle.kts +++ b/android-compose-app/build.gradle.kts @@ -75,6 +75,7 @@ dependencies { debugImplementation(compose.uiTooling) debugImplementation(libs.androidx.compose.test.manifest) implementation(libs.androidx.navigation.compose) + implementation(platform(libs.koin.bom)) implementation(libs.koin.android) implementation(platform(libs.firebase.bom)) implementation(libs.firebase.analytics) diff --git a/desktop-compose-app/build.gradle.kts b/desktop-compose-app/build.gradle.kts index 4fabff42..97bac22c 100644 --- a/desktop-compose-app/build.gradle.kts +++ b/desktop-compose-app/build.gradle.kts @@ -27,7 +27,8 @@ kotlin { implementation(libs.androidx.navigation.compose) implementation(libs.coroutines.swing) implementation(compose.desktop.currentOs) - implementation(libs.koin.core.jvm) + implementation(project.dependencies.platform(libs.koin.bom)) + implementation(libs.koin.core) } jvmTest.dependencies { implementation(project(":jvm-compose-test")) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0cfe2dd4..a312377e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ androidxSqlite = "2.4.0" saferoom = "1.3.0" androidSqlCipher = "4.5.4" iosSqlCipher = "4.5.4" -koin = "3.5.6" +koin-bom = "4.0.0" kotlinx-serialization = "1.7.3" kotlinx-datetime = "0.6.0" napier = "2.7.1" @@ -60,12 +60,13 @@ commonsware-saferoom = { module = "com.commonsware.cwac:saferoom.x", version.ref android-sqlcipher = { module = "net.zetetic:android-database-sqlcipher", version.ref = "androidSqlCipher" } -koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } -koin-core-jvm = { module = "io.insert-koin:koin-core-jvm", 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" } -koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } -koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" } +koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" } +koin-core = { module = "io.insert-koin:koin-core" } +koin-core-viewmodel = { module = "io.insert-koin:koin-core-viewmodel" } +koin-compose-viewmodel-navigation = { module = "io.insert-koin:koin-compose-viewmodel-navigation" } +koin-android = { module = "io.insert-koin:koin-android" } +koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose" } +koin-test = { module = "io.insert-koin:koin-test" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } diff --git a/ios-compose-kit/build.gradle.kts b/ios-compose-kit/build.gradle.kts index d2723a59..2d5e8b93 100644 --- a/ios-compose-kit/build.gradle.kts +++ b/ios-compose-kit/build.gradle.kts @@ -23,6 +23,7 @@ kotlin { baseName = "iosComposeKit" isStatic = true export(project(":shared")) + export(project.dependencies.platform(libs.koin.bom)) export(libs.koin.core) } if (!OperatingSystem.current().isMacOsX) noPodspec() @@ -35,6 +36,7 @@ kotlin { implementation(compose.foundation) implementation(compose.material) implementation(compose.runtime) + implementation(project.dependencies.platform(libs.koin.bom)) api(libs.koin.core) } } diff --git a/jvm-compose-test/build.gradle.kts b/jvm-compose-test/build.gradle.kts index 4b05cb71..6d6b406e 100644 --- a/jvm-compose-test/build.gradle.kts +++ b/jvm-compose-test/build.gradle.kts @@ -16,7 +16,8 @@ dependencies { implementation(project(":shared-compose-ui")) implementation(libs.androidx.lifecycle.common) implementation(libs.androidx.lifecycle.runtime) - implementation(libs.koin.core.jvm) + implementation(platform(libs.koin.bom)) + implementation(libs.koin.core) implementation(libs.turbine) implementation(compose.desktop.uiTestJUnit4) implementation(compose.desktop.currentOs) diff --git a/shared-compose-ui/build.gradle.kts b/shared-compose-ui/build.gradle.kts index 0dcec11e..5bcb3343 100644 --- a/shared-compose-ui/build.gradle.kts +++ b/shared-compose-ui/build.gradle.kts @@ -32,15 +32,19 @@ kotlin { implementation(compose.material3) implementation(compose.materialIconsExtended) implementation(compose.components.resources) + implementation(project.dependencies.platform(libs.koin.bom)) implementation(libs.koin.core) + implementation(libs.koin.compose.viewmodel.navigation) implementation(libs.androidx.navigation.compose) implementation(libs.androidx.lifecycle.runtime.compose) } androidMain.dependencies { + implementation(project.dependencies.platform(libs.koin.bom)) implementation(libs.koin.androidx.compose) } jvmMain.dependencies { - implementation(libs.koin.core.jvm) + implementation(project.dependencies.platform(libs.koin.bom)) + implementation(libs.koin.core) } jvmTest.dependencies { implementation(kotlin("test")) diff --git a/shared-compose-ui/src/androidMain/kotlin/com/softartdev/notedelight/di/androidKoin.kt b/shared-compose-ui/src/androidMain/kotlin/com/softartdev/notedelight/di/androidKoin.kt deleted file mode 100644 index 113bed95..00000000 --- a/shared-compose-ui/src/androidMain/kotlin/com/softartdev/notedelight/di/androidKoin.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.softartdev.notedelight.di - -import androidx.compose.runtime.Composable -import androidx.lifecycle.ViewModel -import org.koin.androidx.compose.koinViewModel - -@Composable -actual inline fun getViewModel(): T = koinViewModel() \ No newline at end of file diff --git a/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/App.kt b/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/App.kt index 41555d13..7916bf27 100644 --- a/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/App.kt +++ b/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/App.kt @@ -9,7 +9,6 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.dialog import androidx.navigation.compose.rememberNavController import androidx.navigation.toRoute -import com.softartdev.notedelight.di.getViewModel import com.softartdev.notedelight.shared.navigation.AppNavGraph import com.softartdev.notedelight.shared.navigation.Router import com.softartdev.notedelight.ui.MainScreen @@ -27,6 +26,7 @@ import com.softartdev.notedelight.ui.dialog.security.EnterPasswordDialog import com.softartdev.theme.material3.PreferableMaterialTheme import com.softartdev.theme.material3.ThemeDialog import com.softartdev.theme.pref.PreferenceHelper +import org.koin.compose.viewmodel.koinViewModel @Composable fun App( @@ -42,22 +42,22 @@ fun App( startDestination = AppNavGraph.Splash, ) { composable { - SplashScreen(splashViewModel = getViewModel()) + SplashScreen(splashViewModel = koinViewModel()) } composable { - SignInScreen(signInViewModel = getViewModel()) + SignInScreen(signInViewModel = koinViewModel()) } composable { - MainScreen(mainViewModel = getViewModel()) + MainScreen(mainViewModel = koinViewModel()) } composable { backStackEntry: NavBackStackEntry -> NoteDetail( - noteViewModel = getViewModel(), + noteViewModel = koinViewModel(), noteId = backStackEntry.toRoute().noteId, ) } composable { - SettingsScreen(settingsViewModel = getViewModel()) + SettingsScreen(settingsViewModel = koinViewModel()) } dialog { val preferenceHelper: PreferenceHelper = themePrefs.preferenceHelper @@ -68,25 +68,25 @@ fun App( ) } dialog { - SaveDialog(saveViewModel = getViewModel()) + SaveDialog(saveViewModel = koinViewModel()) } dialog { backStackEntry: NavBackStackEntry -> EditTitleDialog( noteId = backStackEntry.toRoute().noteId, - editTitleViewModel = getViewModel() + editTitleViewModel = koinViewModel() ) } dialog { - DeleteDialog(deleteViewModel = getViewModel()) + DeleteDialog(deleteViewModel = koinViewModel()) } dialog { - EnterPasswordDialog(enterViewModel = getViewModel()) + EnterPasswordDialog(enterViewModel = koinViewModel()) } dialog { - ConfirmPasswordDialog(confirmViewModel = getViewModel()) + ConfirmPasswordDialog(confirmViewModel = koinViewModel()) } dialog { - ChangePasswordDialog(changeViewModel = getViewModel()) + ChangePasswordDialog(changeViewModel = koinViewModel()) } dialog { backStackEntry: NavBackStackEntry -> ErrorDialog( diff --git a/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/di/commonKoin.kt b/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/di/commonKoin.kt deleted file mode 100644 index 4ebf7fd3..00000000 --- a/shared-compose-ui/src/commonMain/kotlin/com/softartdev/notedelight/di/commonKoin.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.softartdev.notedelight.di - -import androidx.compose.runtime.Composable -import androidx.lifecycle.ViewModel - -@Composable -expect inline fun getViewModel(): T \ No newline at end of file diff --git a/shared-compose-ui/src/iosMain/kotlin/com/softartdev/notedelight/di/getViewModel.kt b/shared-compose-ui/src/iosMain/kotlin/com/softartdev/notedelight/di/getViewModel.kt deleted file mode 100644 index 589f46eb..00000000 --- a/shared-compose-ui/src/iosMain/kotlin/com/softartdev/notedelight/di/getViewModel.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.softartdev.notedelight.di - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.lifecycle.ViewModel -import org.koin.core.Koin -import org.koin.core.context.KoinContext -import org.koin.mp.KoinPlatformTools - -@Composable -actual inline fun getViewModel(): T = remember { - val defaultContext: KoinContext = KoinPlatformTools.defaultContext() - val koin: Koin = defaultContext.get() - return@remember koin.get(clazz = T::class) -} \ No newline at end of file diff --git a/shared-compose-ui/src/jvmMain/kotlin/com/softartdev/notedelight/di/jvmKoin.kt b/shared-compose-ui/src/jvmMain/kotlin/com/softartdev/notedelight/di/jvmKoin.kt deleted file mode 100644 index 26314d66..00000000 --- a/shared-compose-ui/src/jvmMain/kotlin/com/softartdev/notedelight/di/jvmKoin.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.softartdev.notedelight.di - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.lifecycle.ViewModel -import org.koin.java.KoinJavaComponent.get - -@Composable -actual inline fun getViewModel(): T = remember { get(T::class.java) } \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index c26efc6b..a05d51fa 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -63,7 +63,9 @@ kotlin { implementation(libs.sqlDelight.coroutinesExt) api(libs.kotlinx.datetime) api(libs.napier) + implementation(project.dependencies.platform(libs.koin.bom)) implementation(libs.koin.core) + implementation(libs.koin.core.viewmodel) api(libs.material.theme.prefs) implementation(libs.androidx.lifecycle.viewmodel.compose) implementation(libs.kotlinx.serialization.json) @@ -73,6 +75,7 @@ kotlin { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) implementation(libs.coroutines.test) + implementation(project.dependencies.platform(libs.koin.bom)) implementation(libs.koin.test) } androidMain.dependencies { @@ -82,21 +85,19 @@ kotlin { api(libs.commonsware.saferoom) api(libs.android.sqlcipher) api(libs.androidx.lifecycle.viewmodel) + implementation(project.dependencies.platform(libs.koin.bom)) implementation(libs.koin.android) implementation(libs.espresso.idling.resource) } - val androidUnitTest by getting { - dependsOn(commonTest.get()) - dependencies { - implementation(kotlin("test")) - implementation(kotlin("test-junit")) - implementation(libs.junit) - implementation(libs.coroutines.test) - implementation(libs.bundles.mockito) - implementation(libs.sqlDelight.jvm) - implementation(libs.androidx.arch.core.testing) - implementation(libs.turbine) - } + androidUnitTest.dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit")) + implementation(libs.junit) + implementation(libs.coroutines.test) + implementation(libs.bundles.mockito) + implementation(libs.sqlDelight.jvm) + implementation(libs.androidx.arch.core.testing) + implementation(libs.turbine) } iosMain.dependencies { implementation(libs.sqlDelight.native) diff --git a/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidExt.kt b/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidExt.kt deleted file mode 100644 index d61ad22d..00000000 --- a/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidExt.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.softartdev.notedelight.shared.di - -import androidx.lifecycle.ViewModel -import org.koin.androidx.viewmodel.dsl.viewModel -import org.koin.core.definition.Definition -import org.koin.core.definition.KoinDefinition -import org.koin.core.module.Module -import org.koin.core.qualifier.Qualifier - - -actual inline fun Module.viewModelFactory( - qualifier: Qualifier?, - noinline definition: Definition -): KoinDefinition = viewModel(qualifier, definition) \ No newline at end of file diff --git a/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidModules.kt b/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidModules.kt index c09b2728..b8d98655 100644 --- a/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidModules.kt +++ b/shared/src/androidMain/kotlin/com/softartdev/notedelight/shared/di/androidModules.kt @@ -3,8 +3,10 @@ package com.softartdev.notedelight.shared.di import com.softartdev.notedelight.shared.db.AndroidSafeRepo import com.softartdev.notedelight.shared.db.SafeRepo import org.koin.core.module.Module +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.bind import org.koin.dsl.module actual val repoModule: Module = module { - single { AndroidSafeRepo(get()) } + singleOf(::AndroidSafeRepo) bind SafeRepo::class } diff --git a/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/commonExt.kt b/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/commonExt.kt deleted file mode 100644 index f9a1a9c7..00000000 --- a/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/commonExt.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.softartdev.notedelight.shared.di - -import androidx.lifecycle.ViewModel -import org.koin.core.definition.Definition -import org.koin.core.definition.KoinDefinition -import org.koin.core.module.Module -import org.koin.core.qualifier.Qualifier - - -expect inline fun Module.viewModelFactory( - qualifier: Qualifier? = null, - noinline definition: Definition -): KoinDefinition \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/sharedModules.kt b/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/sharedModules.kt index 1b23f30d..55de3f0c 100644 --- a/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/sharedModules.kt +++ b/shared/src/commonMain/kotlin/com/softartdev/notedelight/shared/di/sharedModules.kt @@ -20,6 +20,8 @@ import com.softartdev.notedelight.shared.usecase.note.DeleteNoteUseCase import com.softartdev.notedelight.shared.usecase.note.SaveNoteUseCase import com.softartdev.notedelight.shared.usecase.note.UpdateTitleUseCase import org.koin.core.module.Module +import org.koin.core.module.dsl.factoryOf +import org.koin.core.module.dsl.viewModelOf import org.koin.dsl.module val sharedModules: List @@ -35,25 +37,25 @@ val daoModule: Module = module { } val useCaseModule: Module = module { - factory { ChangePasswordUseCase(get()) } - factory { CheckPasswordUseCase(get()) } - factory { CheckSqlCipherVersionUseCase(get()) } - factory { CreateNoteUseCase(get()) } - factory { SaveNoteUseCase(get()) } - factory { DeleteNoteUseCase(get()) } - factory { UpdateTitleUseCase(get()) } + factoryOf(::ChangePasswordUseCase) + factoryOf(::CheckPasswordUseCase) + factoryOf(::CheckSqlCipherVersionUseCase) + factoryOf(::CreateNoteUseCase) + factoryOf(::SaveNoteUseCase) + factoryOf(::DeleteNoteUseCase) + factoryOf(::UpdateTitleUseCase) } val viewModelModule: Module = module { - viewModelFactory { SplashViewModel(get(), get()) } - viewModelFactory { SignInViewModel(get(), get()) } - viewModelFactory { MainViewModel(get(), get(), get()) } - viewModelFactory { NoteViewModel(get(), get(), get(), get(), get(), get()) } - viewModelFactory { SaveViewModel(get(), get()) } - viewModelFactory { DeleteViewModel(get()) } - viewModelFactory { EditTitleViewModel(get(), get(), get()) } - viewModelFactory { SettingsViewModel(get(), get(), get()) } - viewModelFactory { EnterViewModel(get(), get(), get(), get()) } - viewModelFactory { ConfirmViewModel(get(), get(), get()) } - viewModelFactory { ChangeViewModel(get(), get(), get(), get()) } + viewModelOf(::SplashViewModel) + viewModelOf(::SignInViewModel) + viewModelOf(::MainViewModel) + viewModelOf(::NoteViewModel) + viewModelOf(::SaveViewModel) + viewModelOf(::DeleteViewModel) + viewModelOf(::EditTitleViewModel) + viewModelOf(::SettingsViewModel) + viewModelOf(::EnterViewModel) + viewModelOf(::ConfirmViewModel) + viewModelOf(::ChangeViewModel) } diff --git a/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosExt.kt b/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosExt.kt deleted file mode 100644 index 80a335d2..00000000 --- a/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosExt.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.softartdev.notedelight.shared.di - -import androidx.lifecycle.ViewModel -import org.koin.core.definition.Definition -import org.koin.core.definition.KoinDefinition -import org.koin.core.module.Module -import org.koin.core.qualifier.Qualifier - - -actual inline fun Module.viewModelFactory( - qualifier: Qualifier?, - noinline definition: Definition -): KoinDefinition = factory(qualifier, definition) \ No newline at end of file diff --git a/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosModules.kt b/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosModules.kt index 08be4592..9e717646 100644 --- a/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosModules.kt +++ b/shared/src/iosMain/kotlin/com/softartdev/notedelight/shared/di/iosModules.kt @@ -3,8 +3,10 @@ package com.softartdev.notedelight.shared.di import com.softartdev.notedelight.shared.db.IosSafeRepo import com.softartdev.notedelight.shared.db.SafeRepo import org.koin.core.module.Module +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.bind import org.koin.dsl.module actual val repoModule: Module = module { - single { IosSafeRepo() } + singleOf(::IosSafeRepo) bind SafeRepo::class } \ No newline at end of file diff --git a/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmExt.kt b/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmExt.kt deleted file mode 100644 index 80a335d2..00000000 --- a/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmExt.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.softartdev.notedelight.shared.di - -import androidx.lifecycle.ViewModel -import org.koin.core.definition.Definition -import org.koin.core.definition.KoinDefinition -import org.koin.core.module.Module -import org.koin.core.qualifier.Qualifier - - -actual inline fun Module.viewModelFactory( - qualifier: Qualifier?, - noinline definition: Definition -): KoinDefinition = factory(qualifier, definition) \ No newline at end of file diff --git a/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmModules.kt b/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmModules.kt index 43e6efe6..b0d06b27 100644 --- a/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmModules.kt +++ b/shared/src/jvmMain/kotlin/com/softartdev/notedelight/shared/di/jvmModules.kt @@ -3,8 +3,10 @@ package com.softartdev.notedelight.shared.di import com.softartdev.notedelight.shared.db.JvmSafeRepo import com.softartdev.notedelight.shared.db.SafeRepo import org.koin.core.module.Module +import org.koin.core.module.dsl.singleOf +import org.koin.dsl.bind import org.koin.dsl.module actual val repoModule: Module = module { - single { JvmSafeRepo() } + singleOf(::JvmSafeRepo) bind SafeRepo::class }