Import and setup Koin for multiplatform dependency injection
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
parent
84e4ce8b46
commit
c34bb67689
@ -44,10 +44,23 @@ kotlin {
|
||||
implementation(compose.ui)
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.components.uiToolingPreview)
|
||||
|
||||
// Lifecycle
|
||||
implementation(libs.jetbrains.lifecycle.viewmodel)
|
||||
|
||||
// Koin
|
||||
implementation(project.dependencies.platform(libs.koin.bom))
|
||||
api(libs.koin.annotations)
|
||||
implementation(libs.koin.core)
|
||||
implementation(libs.koin.compose)
|
||||
implementation(libs.koin.viewmodel)
|
||||
}
|
||||
commonTest.dependencies {
|
||||
implementation(libs.kotlin.test)
|
||||
|
||||
// Koin
|
||||
implementation(project.dependencies.platform(libs.koin.bom))
|
||||
implementation(libs.koin.test)
|
||||
}
|
||||
androidMain.dependencies {
|
||||
implementation(compose.preview)
|
||||
@ -58,8 +71,24 @@ kotlin {
|
||||
implementation(libs.jetbrains.kotlinx.coroutinesSwing)
|
||||
}
|
||||
}
|
||||
|
||||
// Koin
|
||||
sourceSets.named("commonMain").configure {
|
||||
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
|
||||
}
|
||||
}
|
||||
|
||||
// Koin
|
||||
dependencies {
|
||||
add("kspCommonMainMetadata", libs.koin.annotations)
|
||||
add("kspAndroid", libs.koin.compiler)
|
||||
add("kspIosArm64", libs.koin.compiler)
|
||||
add("kspIosSimulatorArm64", libs.koin.compiler)
|
||||
}
|
||||
|
||||
tasks.matching { it.name.startsWith("ksp") && it.name != "kspCommonMainKotlinMetadata" }
|
||||
.configureEach { dependsOn("kspCommonMainKotlinMetadata") }
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "net.newpipe.app.MainKt"
|
||||
|
||||
@ -6,13 +6,22 @@
|
||||
package net.newpipe.app
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import net.newpipe.app.module.appModules
|
||||
import net.newpipe.app.theme.AppTheme
|
||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||
import org.koin.compose.KoinMultiplatformApplication
|
||||
import org.koin.core.annotation.KoinExperimentalAPI
|
||||
import org.koin.dsl.koinConfiguration
|
||||
|
||||
@OptIn(KoinExperimentalAPI::class)
|
||||
@Composable
|
||||
@Preview
|
||||
fun App() {
|
||||
AppTheme {
|
||||
KoinMultiplatformApplication(
|
||||
config = koinConfiguration {
|
||||
modules(appModules)
|
||||
}
|
||||
) {
|
||||
AppTheme {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package net.newpipe.app.module
|
||||
|
||||
import org.koin.dsl.module
|
||||
|
||||
val appModules = module {
|
||||
|
||||
}
|
||||
@ -26,6 +26,8 @@ hotreload = "1.0.0"
|
||||
jsoup = "1.21.2"
|
||||
junit = "4.13.2"
|
||||
junit-ext = "1.3.0"
|
||||
koin-annotations = "2.3.1"
|
||||
koin-bom = "4.1.1"
|
||||
kotlin = "2.2.21"
|
||||
ksp = "2.3.2"
|
||||
ktlint = "1.8.0"
|
||||
@ -117,6 +119,13 @@ jetbrains-kotlinx-coroutinesSwing = { module = "org.jetbrains.kotlinx:kotlinx-co
|
||||
jetbrains-lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle-jetbrains" }
|
||||
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
|
||||
junit = { module = "junit:junit", version.ref = "junit" }
|
||||
koin-annotations = { module = "io.insert-koin:koin-annotations", version.ref = "koin-annotations" }
|
||||
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" }
|
||||
koin-compiler = { module = "io.insert-koin:koin-ksp-compiler", version.ref = "koin-annotations" }
|
||||
koin-compose = { module = "io.insert-koin:koin-compose" }
|
||||
koin-core = { module = "io.insert-koin:koin-core" }
|
||||
koin-test = { module = "io.insert-koin:koin-test" }
|
||||
koin-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel" }
|
||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||
lisawray-groupie-core = { module = "com.github.lisawray.groupie:groupie", version.ref = "groupie" }
|
||||
lisawray-groupie-viewbinding = { module = "com.github.lisawray.groupie:groupie-viewbinding", version.ref = "groupie" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user