Initial commit

This commit is contained in:
tanexc
2026-06-12 23:49:11 +03:00
commit f69ffd79c2
222 changed files with 7094 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/build
+58
View File
@@ -0,0 +1,58 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidMultiplatformLibrary)
alias(libs.plugins.kotlinxSerialization)
}
kotlin {
android {
namespace = "ru.tanexc.hemoanalysis.navigation"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
compileSdk {
version = release(36)
}
minSdk = 26
}
listOf(
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "navigationkit"
isStatic = true
}
}
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.compose.foundation)
// decompose
implementation(libs.decompose)
implementation(libs.decompose.extensions.compose)
implementation(libs.decompose.extensions.compose.experimental)
implementation(libs.essenty.lifecycle)
// koin
implementation(libs.koin.core)
}
}
androidMain {
dependencies {
implementation(libs.androidx.activity.ktx)
}
}
}
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
@@ -0,0 +1,16 @@
package ru.tanexc.hemoanalysis.navigation
import com.arkivanov.decompose.ComponentContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.SupervisorJob
abstract class BaseComponent(
val context: ComponentContext,
val onNavigate: (Config) -> Unit,
val onBack: () -> Unit
): ComponentContext by context {
val componentScope: CoroutineScope
get() = CoroutineScope(SupervisorJob() + Dispatchers.IO).withLifecycle(lifecycle)
}
@@ -0,0 +1,26 @@
package ru.tanexc.hemoanalysis.navigation
import kotlinx.serialization.Serializable
@Serializable
sealed class Config(
val navLabelResId: String,
val navIconResId: String
) {
@Serializable
data object Analysis: Config(
navLabelResId = "analysis_label",
navIconResId = "analysis",
)
@Serializable
data object Settings: Config(
navLabelResId = "settings_label",
navIconResId = "settings",
)
companion object {
val navEntries: List<Config> = listOf(Analysis, Settings)
}
}
@@ -0,0 +1,17 @@
package ru.tanexc.hemoanalysis.navigation
import com.arkivanov.essenty.lifecycle.Lifecycle
import com.arkivanov.essenty.lifecycle.doOnDestroy
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import org.koin.core.parameter.parametersOf
import org.koin.mp.KoinPlatform.getKoin
fun CoroutineScope.withLifecycle(lifecycle: Lifecycle): CoroutineScope {
lifecycle.doOnDestroy(::cancel)
return this
}
inline fun <reified T : BaseComponent> getComponent(vararg parameters: Any?) = getKoin().get<T> {
parametersOf(*parameters)
}