Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,56 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.androidMultiplatformLibrary)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
android {
|
||||
namespace = "ru.tanexc.hemoanalysis.core.database"
|
||||
compileSdk {
|
||||
version = release(36)
|
||||
}
|
||||
minSdk = 26
|
||||
}
|
||||
|
||||
listOf(
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
).forEach { iosTarget ->
|
||||
iosTarget.binaries.framework {
|
||||
baseName = "databasekit"
|
||||
isStatic = true
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
// settings store
|
||||
implementation(libs.multiplatform.settings)
|
||||
implementation(libs.multiplatform.settings.serialization)
|
||||
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
|
||||
// koin
|
||||
implementation(libs.koin.core)
|
||||
}
|
||||
}
|
||||
|
||||
androidMain {
|
||||
dependencies {
|
||||
// datastore
|
||||
implementation(libs.androidx.datastore)
|
||||
implementation(libs.androidx.datastore.preferences)
|
||||
}
|
||||
}
|
||||
|
||||
iosMain {
|
||||
dependencies {
|
||||
// datastore
|
||||
implementation(libs.androidx.datastore)
|
||||
implementation(libs.androidx.datastore.preferences)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</manifest>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import android.content.Context
|
||||
import com.russhwolf.settings.Settings
|
||||
import com.russhwolf.settings.SharedPreferencesSettings
|
||||
import org.koin.core.scope.Scope
|
||||
|
||||
internal actual fun Scope.createAnalysisParamsSettings(): Settings {
|
||||
return SharedPreferencesSettings(
|
||||
delegate = get<Context>().getSharedPreferences("analysis_params_settings", Context.MODE_PRIVATE)
|
||||
)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import android.content.Context
|
||||
import com.russhwolf.settings.Settings
|
||||
import com.russhwolf.settings.SharedPreferencesSettings
|
||||
import org.koin.core.scope.Scope
|
||||
|
||||
internal actual fun Scope.createModelInfoSettings(): Settings {
|
||||
return SharedPreferencesSettings(
|
||||
delegate = get<Context>().getSharedPreferences("model_info_settings", Context.MODE_PRIVATE)
|
||||
)
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import com.russhwolf.settings.Settings
|
||||
import org.koin.core.scope.Scope
|
||||
|
||||
internal expect fun Scope.createAnalysisParamsSettings(): Settings
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import com.russhwolf.settings.Settings
|
||||
import org.koin.core.qualifier.StringQualifier
|
||||
import org.koin.dsl.module
|
||||
|
||||
val databaseModule = module {
|
||||
single<Settings>(qualifier = StringQualifier("AnalysisParamsSettings")) { createAnalysisParamsSettings() }
|
||||
single<Settings>(qualifier = StringQualifier("ModelInfoSettings")) { createModelInfoSettings() }
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import com.russhwolf.settings.Settings
|
||||
import org.koin.core.scope.Scope
|
||||
|
||||
internal expect fun Scope.createModelInfoSettings(): Settings
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import com.russhwolf.settings.NSUserDefaultsSettings
|
||||
import com.russhwolf.settings.Settings
|
||||
import org.koin.core.scope.Scope
|
||||
import platform.Foundation.NSUserDefaults
|
||||
|
||||
internal actual fun Scope.createAnalysisParamsSettings(): Settings {
|
||||
return NSUserDefaultsSettings(
|
||||
delegate = NSUserDefaults.standardUserDefaults
|
||||
)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package ru.tanexc.hemoanalysis.core.database
|
||||
|
||||
import com.russhwolf.settings.NSUserDefaultsSettings
|
||||
import com.russhwolf.settings.Settings
|
||||
import org.koin.core.scope.Scope
|
||||
import platform.Foundation.NSUserDefaults
|
||||
|
||||
internal actual fun Scope.createModelInfoSettings(): Settings {
|
||||
return NSUserDefaultsSettings(
|
||||
delegate = NSUserDefaults.standardUserDefaults
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user