Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Koin Annotations 2.0-Beta2 + Koin 4.0.1-Beta1 #402

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions common/src/commonMain/kotlin/com/surrus/common/di/Koin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,20 @@ import org.koin.core.annotation.ComponentScan
import org.koin.core.annotation.Module
import org.koin.core.annotation.Single
import org.koin.core.context.startKoin
import org.koin.core.module.dsl.singleOf
import org.koin.dsl.KoinAppDeclaration
import org.koin.dsl.bind
import org.koin.dsl.module
import org.koin.dsl.includes
import org.koin.ksp.generated.module


fun initKoin(enableNetworkLogs: Boolean = false, appDeclaration: KoinAppDeclaration = {}) =
fun initKoin(enableNetworkLogs: Boolean = false, appDeclaration: KoinAppDeclaration? = null) =
startKoin {
appDeclaration()
//modules(commonModule(enableNetworkLogs = enableNetworkLogs), platformModule())
startKoin {
modules(
AppModule().module
)
appDeclaration.invoke(this)
}
modules(
AppModule().module
)
includes(appDeclaration)
}

// called by iOS etc
fun initKoin() = initKoin(enableNetworkLogs = false) {}
fun initKoin() = initKoin(enableNetworkLogs = false)


@Module(includes = [CommonModule::class, NativeModule::class])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.surrus.common.di

import com.surrus.peopleinspace.db.PeopleInSpaceDatabase
import org.koin.core.annotation.Single

@Single
class PeopleInSpaceDatabaseWrapper(val instance: PeopleInSpaceDatabase?)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface PeopleInSpaceRepositoryInterface {
suspend fun fetchAndStorePeople()
}


@Single
class PeopleInSpaceRepository(
private val peopleInSpaceApi: PeopleInSpaceApi,
private val peopleInSpaceDatabase: PeopleInSpaceDatabaseWrapper
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[versions]
kotlin = "2.0.21"
ksp = "2.0.21-1.0.26"
ksp = "2.0.21-1.0.28"

compose-multiplatform = "1.7.0"
composeUiTooling = "1.4.0"
coroutines = "1.9.0"
kotlinxSerialization = "1.7.3"
androidGradlePlugin = "8.7.2"
koin = "4.0.0"
koin-annotations = "2.0.0-Beta1"
koin = "4.0.1-Beta1"
koin-annotations = "2.0.0-Beta2"
koinCompose = "4.0.0"
koinComposeMultiplatform = "4.0.0"
ktor = "3.0.0"
Expand Down
14 changes: 14 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ pluginManagement {
}
}

dependencyResolutionManagement {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oups, I can remove that

repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
mavenLocal()
}
}

rootProject.name = "PeopleInSpace"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include(":app")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class PeopleInSpaceApplication : Application(), KoinComponent, ImageLoaderFactor
androidLogger(if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
androidContext(this@PeopleInSpaceApplication)

modules(wearImageLoader)
modules(wearAppModule)
modules(wearImageLoader, wearAppModule)
}

Logger.d { "PeopleInSpaceApplication" }
Expand Down
Loading