From a1854b68d82c46b0da1e20a38870d6e6fb18a9d0 Mon Sep 17 00:00:00 2001
From: InsanusMokrassar <ovsyannikov.alexey95@gmail.com>
Date: Sun, 12 May 2024 19:17:16 +0600
Subject: [PATCH] almost updated dependencies and modules hierarchy

---
 .../src/androidMain/kotlin/NumberPicker.kt    |  5 +--
 .../src/androidMain/kotlin/SetPicker.kt       |  5 +--
 common/build.gradle                           | 14 +-----
 common/src/androidMain/AndroidManifest.xml    |  1 -
 .../micro_utils/common/DateTimeSerializer.kt  |  4 +-
 .../src/linuxX64Main/kotlin/ActualMPPFile.kt  | 36 ---------------
 common/src/linuxX64Main/kotlin/fixed.kt       | 25 -----------
 .../src/mingwX64Main/kotlin/ActualMPPFile.kt  | 36 ---------------
 common/src/mingwX64Main/kotlin/fixed.kt       | 25 -----------
 .../kotlin/ActualMPPFile.kt                   |  0
 .../kotlin/fixed.kt                           |  0
 coroutines/build.gradle                       |  1 -
 .../micro_utils/coroutines/DoWithFirst.kt     |  4 +-
 .../coroutines/FlowSubscriptionAsync.kt       | 22 +++++-----
 .../micro_utils/coroutines/HandleSafely.kt    | 44 +++++++++----------
 .../micro_utils/coroutines/LaunchSafely.kt    | 24 +++++-----
 .../coroutines/SpecialMutableStateFlow.kt     | 10 ++++-
 .../kotlin/SpecialMutableStateFlowTests.kt    | 35 +++++++++++++++
 gradle/libs.versions.toml                     | 10 ++---
 ktor/client/build.gradle                      |  3 --
 ktor/common/build.gradle                      |  3 --
 language_codes/build.gradle                   |  8 ----
 .../language_codes/LanguageCodes.kt           |  2 +
 ...sAndroidLinuxMingwLinuxArm64Project.gradle |  6 +++
 mppJvmJsLinuxMingwLinuxArm64Project.gradle    |  7 +++
 mppJvmJsLinuxMingwProject.gradle              |  4 ++
 mppProjectWithSerializationAndCompose.gradle  |  2 -
 repos/common/build.gradle                     |  1 -
 resources/build.gradle                        |  4 --
 29 files changed, 120 insertions(+), 221 deletions(-)
 delete mode 100644 common/src/androidMain/AndroidManifest.xml
 delete mode 100644 common/src/linuxX64Main/kotlin/ActualMPPFile.kt
 delete mode 100644 common/src/linuxX64Main/kotlin/fixed.kt
 delete mode 100644 common/src/mingwX64Main/kotlin/ActualMPPFile.kt
 delete mode 100644 common/src/mingwX64Main/kotlin/fixed.kt
 rename common/src/{linuxArm64Main => nativeMain}/kotlin/ActualMPPFile.kt (100%)
 rename common/src/{linuxArm64Main => nativeMain}/kotlin/fixed.kt (100%)
 create mode 100644 coroutines/src/commonTest/kotlin/SpecialMutableStateFlowTests.kt

diff --git a/android/pickers/src/androidMain/kotlin/NumberPicker.kt b/android/pickers/src/androidMain/kotlin/NumberPicker.kt
index 4226e1d4168..59265e0f855 100644
--- a/android/pickers/src/androidMain/kotlin/NumberPicker.kt
+++ b/android/pickers/src/androidMain/kotlin/NumberPicker.kt
@@ -7,9 +7,6 @@ import androidx.compose.foundation.gestures.*
 import androidx.compose.foundation.layout.*
 import androidx.compose.foundation.text.KeyboardActions
 import androidx.compose.foundation.text.KeyboardOptions
-import androidx.compose.material.ContentAlpha
-import androidx.compose.material.IconButton
-import androidx.compose.material.ProvideTextStyle
 import androidx.compose.material.icons.Icons
 import androidx.compose.material.icons.filled.KeyboardArrowDown
 import androidx.compose.material.icons.filled.KeyboardArrowUp
@@ -75,7 +72,7 @@ fun NumberPicker(
     }
     val coercedAnimatedOffset = animatedOffset.value % halvedNumbersColumnHeightPx
     val animatedStateValue = animatedStateValue(animatedOffset.value)
-    val disabledArrowsColor = arrowsColor.copy(alpha = ContentAlpha.disabled)
+    val disabledArrowsColor = arrowsColor.copy(alpha = 0f)
 
     val inputFieldShown = if (allowUseManualInput) {
         remember { mutableStateOf(false) }
diff --git a/android/pickers/src/androidMain/kotlin/SetPicker.kt b/android/pickers/src/androidMain/kotlin/SetPicker.kt
index b1cfc9fbebd..60b2fbe34cf 100644
--- a/android/pickers/src/androidMain/kotlin/SetPicker.kt
+++ b/android/pickers/src/androidMain/kotlin/SetPicker.kt
@@ -5,7 +5,6 @@ import androidx.compose.animation.core.exponentialDecay
 import androidx.compose.foundation.gestures.*
 import androidx.compose.foundation.layout.*
 import androidx.compose.foundation.rememberScrollState
-import androidx.compose.material.ContentAlpha
 import androidx.compose.material.icons.Icons
 import androidx.compose.material.icons.filled.KeyboardArrowDown
 import androidx.compose.material.icons.filled.KeyboardArrowUp
@@ -62,9 +61,7 @@ fun <T> SetPicker(
         (index - ceil(animatedOffset.value / halvedNumbersColumnHeightPx).toInt())
     }
     val coercedAnimatedOffset = animatedOffset.value % halvedNumbersColumnHeightPx
-    val boxOffset = (indexAnimatedOffset * halvedNumbersColumnHeightPx) - coercedAnimatedOffset
-    val disabledArrowsColor = arrowsColor.copy(alpha = ContentAlpha.disabled)
-    val scrollState = rememberScrollState()
+    val disabledArrowsColor = arrowsColor.copy(alpha = 0f)
 
     Column(
         modifier = modifier
diff --git a/common/build.gradle b/common/build.gradle
index 840e2fb8a68..01489bbf4f1 100644
--- a/common/build.gradle
+++ b/common/build.gradle
@@ -20,23 +20,11 @@ kotlin {
         }
         androidMain {
             dependencies {
-                api project(":micro_utils.coroutines")
                 api libs.android.fragment
             }
-            dependsOn jvmMain
         }
 
-        linuxX64Main {
-            dependencies {
-                api libs.okio
-            }
-        }
-        mingwX64Main {
-            dependencies {
-                api libs.okio
-            }
-        }
-        linuxArm64Main {
+        nativeMain {
             dependencies {
                 api libs.okio
             }
diff --git a/common/src/androidMain/AndroidManifest.xml b/common/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 15e7c2ae675..00000000000
--- a/common/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1 +0,0 @@
-<manifest/>
\ No newline at end of file
diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DateTimeSerializer.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DateTimeSerializer.kt
index 245f66b5198..89c2220c882 100644
--- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DateTimeSerializer.kt
+++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/DateTimeSerializer.kt
@@ -8,7 +8,9 @@ import kotlinx.serialization.descriptors.SerialDescriptor
 import kotlinx.serialization.encoding.Decoder
 import kotlinx.serialization.encoding.Encoder
 
-@Serializer(DateTime::class)
+/**
+ * Serializes [DateTime] as its raw [DateTime.unixMillis] and deserializes in the same way
+ */
 object DateTimeSerializer : KSerializer<DateTime> {
     override val descriptor: SerialDescriptor
         get() = Double.serializer().descriptor
diff --git a/common/src/linuxX64Main/kotlin/ActualMPPFile.kt b/common/src/linuxX64Main/kotlin/ActualMPPFile.kt
deleted file mode 100644
index ff5f9619c53..00000000000
--- a/common/src/linuxX64Main/kotlin/ActualMPPFile.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package dev.inmo.micro_utils.common
-
-import okio.FileSystem
-import okio.Path
-import okio.use
-
-actual typealias MPPFile = Path
-
-/**
- * @suppress
- */
-actual val MPPFile.filename: FileName
-    get() = FileName(toString())
-/**
- * @suppress
- */
-actual val MPPFile.filesize: Long
-    get() = FileSystem.SYSTEM.openReadOnly(this).use {
-        it.size()
-    }
-/**
- * @suppress
- */
-actual val MPPFile.bytesAllocatorSync: ByteArrayAllocator
-    get() = {
-        FileSystem.SYSTEM.read(this) {
-            readByteArray()
-        }
-    }
-/**
- * @suppress
- */
-actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
-    get() = {
-        bytesAllocatorSync()
-    }
diff --git a/common/src/linuxX64Main/kotlin/fixed.kt b/common/src/linuxX64Main/kotlin/fixed.kt
deleted file mode 100644
index 14e0a168cba..00000000000
--- a/common/src/linuxX64Main/kotlin/fixed.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package dev.inmo.micro_utils.common
-
-import kotlinx.cinterop.*
-import platform.posix.snprintf
-import platform.posix.sprintf
-
-@OptIn(ExperimentalForeignApi::class)
-actual fun Float.fixed(signs: Int): Float {
-    return memScoped {
-        val buff = allocArray<ByteVar>(Float.SIZE_BYTES * 2)
-
-        sprintf(buff, "%.${signs}f", this@fixed)
-        buff.toKString().toFloat()
-    }
-}
-
-@OptIn(ExperimentalForeignApi::class)
-actual fun Double.fixed(signs: Int): Double {
-    return memScoped {
-        val buff = allocArray<ByteVar>(Double.SIZE_BYTES * 2)
-
-        sprintf(buff, "%.${signs}f", this@fixed)
-        buff.toKString().toDouble()
-    }
-}
diff --git a/common/src/mingwX64Main/kotlin/ActualMPPFile.kt b/common/src/mingwX64Main/kotlin/ActualMPPFile.kt
deleted file mode 100644
index ff5f9619c53..00000000000
--- a/common/src/mingwX64Main/kotlin/ActualMPPFile.kt
+++ /dev/null
@@ -1,36 +0,0 @@
-package dev.inmo.micro_utils.common
-
-import okio.FileSystem
-import okio.Path
-import okio.use
-
-actual typealias MPPFile = Path
-
-/**
- * @suppress
- */
-actual val MPPFile.filename: FileName
-    get() = FileName(toString())
-/**
- * @suppress
- */
-actual val MPPFile.filesize: Long
-    get() = FileSystem.SYSTEM.openReadOnly(this).use {
-        it.size()
-    }
-/**
- * @suppress
- */
-actual val MPPFile.bytesAllocatorSync: ByteArrayAllocator
-    get() = {
-        FileSystem.SYSTEM.read(this) {
-            readByteArray()
-        }
-    }
-/**
- * @suppress
- */
-actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
-    get() = {
-        bytesAllocatorSync()
-    }
diff --git a/common/src/mingwX64Main/kotlin/fixed.kt b/common/src/mingwX64Main/kotlin/fixed.kt
deleted file mode 100644
index 14e0a168cba..00000000000
--- a/common/src/mingwX64Main/kotlin/fixed.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package dev.inmo.micro_utils.common
-
-import kotlinx.cinterop.*
-import platform.posix.snprintf
-import platform.posix.sprintf
-
-@OptIn(ExperimentalForeignApi::class)
-actual fun Float.fixed(signs: Int): Float {
-    return memScoped {
-        val buff = allocArray<ByteVar>(Float.SIZE_BYTES * 2)
-
-        sprintf(buff, "%.${signs}f", this@fixed)
-        buff.toKString().toFloat()
-    }
-}
-
-@OptIn(ExperimentalForeignApi::class)
-actual fun Double.fixed(signs: Int): Double {
-    return memScoped {
-        val buff = allocArray<ByteVar>(Double.SIZE_BYTES * 2)
-
-        sprintf(buff, "%.${signs}f", this@fixed)
-        buff.toKString().toDouble()
-    }
-}
diff --git a/common/src/linuxArm64Main/kotlin/ActualMPPFile.kt b/common/src/nativeMain/kotlin/ActualMPPFile.kt
similarity index 100%
rename from common/src/linuxArm64Main/kotlin/ActualMPPFile.kt
rename to common/src/nativeMain/kotlin/ActualMPPFile.kt
diff --git a/common/src/linuxArm64Main/kotlin/fixed.kt b/common/src/nativeMain/kotlin/fixed.kt
similarity index 100%
rename from common/src/linuxArm64Main/kotlin/fixed.kt
rename to common/src/nativeMain/kotlin/fixed.kt
diff --git a/coroutines/build.gradle b/coroutines/build.gradle
index 91a9ff9f65f..8c246516b70 100644
--- a/coroutines/build.gradle
+++ b/coroutines/build.gradle
@@ -22,7 +22,6 @@ kotlin {
             dependencies {
                 api libs.kt.coroutines.android
             }
-            dependsOn(jvmMain)
         }
     }
 }
diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoWithFirst.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoWithFirst.kt
index 94891715b83..2288349de6b 100644
--- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoWithFirst.kt
+++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/DoWithFirst.kt
@@ -16,8 +16,8 @@ class DoWithFirstBuilder<T>(
     operator fun plus(block: suspend CoroutineScope.() -> T) {
         deferreds.add(scope.async(start = CoroutineStart.LAZY, block = block))
     }
-    inline fun add(noinline block: suspend CoroutineScope.() -> T) = plus(block)
-    inline fun include(noinline block: suspend CoroutineScope.() -> T) = plus(block)
+    fun add(block: suspend CoroutineScope.() -> T) = plus(block)
+    fun include(block: suspend CoroutineScope.() -> T) = plus(block)
 
     fun build() = deferreds.toList()
 }
diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt
index 7bde7300015..5a8bea14a88 100644
--- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt
+++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/FlowSubscriptionAsync.kt
@@ -85,32 +85,32 @@ fun <T, M> Flow<T>.subscribeAsync(
     return job
 }
 
-inline fun <T, M> Flow<T>.subscribeSafelyAsync(
+fun <T, M> Flow<T>.subscribeSafelyAsync(
     scope: CoroutineScope,
-    noinline markerFactory: suspend (T) -> M,
-    noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler,
-    noinline block: suspend (T) -> Unit
+    markerFactory: suspend (T) -> M,
+    onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler,
+    block: suspend (T) -> Unit
 ) = subscribeAsync(scope, markerFactory) {
     safely(onException) {
         block(it)
     }
 }
 
-inline fun <T, M> Flow<T>.subscribeSafelyWithoutExceptionsAsync(
+fun <T, M> Flow<T>.subscribeSafelyWithoutExceptionsAsync(
     scope: CoroutineScope,
-    noinline markerFactory: suspend (T) -> M,
-    noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
-    noinline block: suspend (T) -> Unit
+    markerFactory: suspend (T) -> M,
+    onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
+    block: suspend (T) -> Unit
 ) = subscribeAsync(scope, markerFactory) {
     safelyWithoutExceptions(onException) {
         block(it)
     }
 }
 
-inline fun <T, M> Flow<T>.subscribeSafelySkippingExceptionsAsync(
+fun <T, M> Flow<T>.subscribeSafelySkippingExceptionsAsync(
     scope: CoroutineScope,
-    noinline markerFactory: suspend (T) -> M,
-    noinline block: suspend (T) -> Unit
+    markerFactory: suspend (T) -> M,
+    block: suspend (T) -> Unit
 ) = subscribeAsync(scope, markerFactory) {
     safelyWithoutExceptions({ /* do nothing */}) {
         block(it)
diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt
index c8ab319ea48..3b1a93e8f0a 100644
--- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt
+++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/HandleSafely.kt
@@ -51,7 +51,7 @@ class ContextSafelyExceptionHandler(
  * @see ContextSafelyExceptionHandler
  * @see ContextSafelyExceptionHandlerKey
  */
-suspend inline fun contextSafelyExceptionHandler() = coroutineContext[ContextSafelyExceptionHandlerKey]
+suspend fun contextSafelyExceptionHandler() = coroutineContext[ContextSafelyExceptionHandlerKey]
 
 /**
  * This method will set new [coroutineContext] with [ContextSafelyExceptionHandler]. In case if [coroutineContext]
@@ -96,9 +96,9 @@ suspend fun <T> safelyWithContextExceptionHandler(
  * @see safelyWithoutExceptions
  * @see safelyWithContextExceptionHandler
  */
-suspend inline fun <T> safely(
-    noinline onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
-    noinline block: suspend CoroutineScope.() -> T
+suspend fun <T> safely(
+    onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
+    block: suspend CoroutineScope.() -> T
 ): T {
     return try {
         supervisorScope(block)
@@ -108,26 +108,26 @@ suspend inline fun <T> safely(
     }
 }
 
-suspend inline fun <T> runCatchingSafely(
-    noinline onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
-    noinline block: suspend CoroutineScope.() -> T
+suspend fun <T> runCatchingSafely(
+    onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
+    block: suspend CoroutineScope.() -> T
 ): Result<T> = runCatching {
     safely(onException, block)
 }
 
-suspend inline fun <T, R> T.runCatchingSafely(
-    noinline onException: ExceptionHandler<R> = defaultSafelyExceptionHandler,
-    noinline block: suspend T.() -> R
+suspend fun <T, R> T.runCatchingSafely(
+    onException: ExceptionHandler<R> = defaultSafelyExceptionHandler,
+    block: suspend T.() -> R
 ): Result<R> = runCatching {
     safely(onException) { block() }
 }
 
-suspend inline fun <T> safelyWithResult(
-    noinline block: suspend CoroutineScope.() -> T
+suspend fun <T> safelyWithResult(
+    block: suspend CoroutineScope.() -> T
 ): Result<T> = runCatchingSafely(defaultSafelyExceptionHandler, block)
 
-suspend inline fun <T, R> T.safelyWithResult(
-    noinline block: suspend T.() -> R
+suspend fun <T, R> T.safelyWithResult(
+    block: suspend T.() -> R
 ): Result<R> = runCatchingSafely(defaultSafelyExceptionHandler, block)
 
 /**
@@ -147,21 +147,21 @@ val defaultSafelyWithoutExceptionHandlerWithNull: ExceptionHandler<Nothing?> = {
  * Shortcut for [safely] with exception handler, that as expected must return null in case of impossible creating of
  * result from exception (instead of throwing it, by default always returns null)
  */
-suspend inline fun <T> safelyWithoutExceptions(
-    noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
-    noinline block: suspend CoroutineScope.() -> T
+suspend fun <T> safelyWithoutExceptions(
+    onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
+    block: suspend CoroutineScope.() -> T
 ): T? = safely(onException, block)
 
-suspend inline fun <T> runCatchingSafelyWithoutExceptions(
-    noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
-    noinline block: suspend CoroutineScope.() -> T
+suspend fun <T> runCatchingSafelyWithoutExceptions(
+    onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
+    block: suspend CoroutineScope.() -> T
 ): Result<T?> = runCatching {
     safelyWithoutExceptions(onException, block)
 }
 
-inline fun CoroutineScope(
+fun CoroutineScope(
     context: CoroutineContext,
-    noinline defaultExceptionsHandler: ExceptionHandler<Unit>
+    defaultExceptionsHandler: ExceptionHandler<Unit>
 ) = CoroutineScope(
     context + ContextSafelyExceptionHandler(defaultExceptionsHandler)
 )
diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSafely.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSafely.kt
index ff4850d5463..ee3cd890c44 100644
--- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSafely.kt
+++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/LaunchSafely.kt
@@ -4,38 +4,38 @@ import kotlinx.coroutines.*
 import kotlin.coroutines.CoroutineContext
 import kotlin.coroutines.EmptyCoroutineContext
 
-inline fun CoroutineScope.launchSafely(
+fun CoroutineScope.launchSafely(
     context: CoroutineContext = EmptyCoroutineContext,
     start: CoroutineStart = CoroutineStart.DEFAULT,
-    noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler,
-    noinline block: suspend CoroutineScope.() -> Unit
+    onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler,
+    block: suspend CoroutineScope.() -> Unit
 ) = launch(context, start) {
     safely(onException, block)
 }
 
-inline fun CoroutineScope.launchSafelyWithoutExceptions(
+fun CoroutineScope.launchSafelyWithoutExceptions(
     context: CoroutineContext = EmptyCoroutineContext,
     start: CoroutineStart = CoroutineStart.DEFAULT,
-    noinline onException: ExceptionHandler<Unit?> = defaultSafelyWithoutExceptionHandlerWithNull,
-    noinline block: suspend CoroutineScope.() -> Unit
+    onException: ExceptionHandler<Unit?> = defaultSafelyWithoutExceptionHandlerWithNull,
+    block: suspend CoroutineScope.() -> Unit
 ) = launch(context, start) {
     safelyWithoutExceptions(onException, block)
 }
 
-inline fun <T> CoroutineScope.asyncSafely(
+fun <T> CoroutineScope.asyncSafely(
     context: CoroutineContext = EmptyCoroutineContext,
     start: CoroutineStart = CoroutineStart.DEFAULT,
-    noinline onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
-    noinline block: suspend CoroutineScope.() -> T
+    onException: ExceptionHandler<T> = defaultSafelyExceptionHandler,
+    block: suspend CoroutineScope.() -> T
 ) = async(context, start) {
     safely(onException, block)
 }
 
-inline fun <T> CoroutineScope.asyncSafelyWithoutExceptions(
+fun <T> CoroutineScope.asyncSafelyWithoutExceptions(
     context: CoroutineContext = EmptyCoroutineContext,
     start: CoroutineStart = CoroutineStart.DEFAULT,
-    noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
-    noinline block: suspend CoroutineScope.() -> T
+    onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull,
+    block: suspend CoroutineScope.() -> T
 ) = async(context, start) {
     safelyWithoutExceptions(onException, block)
 }
diff --git a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SpecialMutableStateFlow.kt b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SpecialMutableStateFlow.kt
index ecc421aa5cb..ac892987fc9 100644
--- a/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SpecialMutableStateFlow.kt
+++ b/coroutines/src/commonMain/kotlin/dev/inmo/micro_utils/coroutines/SpecialMutableStateFlow.kt
@@ -11,6 +11,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
 import kotlinx.coroutines.flow.StateFlow
 import kotlinx.coroutines.internal.SynchronizedObject
 import kotlinx.coroutines.internal.synchronized
+import kotlin.coroutines.CoroutineContext
 
 /**
  * Works like [StateFlow], but guarantee that latest value update will always be delivered to
@@ -18,7 +19,7 @@ import kotlinx.coroutines.internal.synchronized
  */
 open class SpecialMutableStateFlow<T>(
     initialValue: T,
-    internalScope: CoroutineScope = CoroutineScope(Dispatchers.Default)
+    internalScope: CoroutineScope
 ) : MutableStateFlow<T>, FlowCollector<T>, MutableSharedFlow<T> {
     @OptIn(InternalCoroutinesApi::class)
     private val syncObject = SynchronizedObject()
@@ -37,7 +38,7 @@ open class SpecialMutableStateFlow<T>(
     override var value: T
         get() = _value
         set(value) {
-            doOnChangeAction(value)
+            internalSharedFlow.tryEmit(value)
         }
     protected val job = internalSharedFlow.subscribe(internalScope) {
         doOnChangeAction(it)
@@ -48,6 +49,11 @@ open class SpecialMutableStateFlow<T>(
     override val subscriptionCount: StateFlow<Int>
         get() = publicSharedFlow.subscriptionCount
 
+    constructor(
+        initialValue: T,
+        internalContext: CoroutineContext = Dispatchers.Default
+    ) : this(initialValue, CoroutineScope(internalContext))
+
     @OptIn(InternalCoroutinesApi::class)
     override fun compareAndSet(expect: T, update: T): Boolean {
         return synchronized(syncObject) {
diff --git a/coroutines/src/commonTest/kotlin/SpecialMutableStateFlowTests.kt b/coroutines/src/commonTest/kotlin/SpecialMutableStateFlowTests.kt
new file mode 100644
index 00000000000..36501bdf2e7
--- /dev/null
+++ b/coroutines/src/commonTest/kotlin/SpecialMutableStateFlowTests.kt
@@ -0,0 +1,35 @@
+import dev.inmo.micro_utils.coroutines.SpecialMutableStateFlow
+import dev.inmo.micro_utils.coroutines.subscribe
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.flow.first
+import kotlinx.coroutines.test.runTest
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class SpecialMutableStateFlowTests {
+    @Test
+    fun simpleTest() {
+        val specialMutableStateFlow = SpecialMutableStateFlow(0)
+        runTest {
+            specialMutableStateFlow.value = 1
+            specialMutableStateFlow.first { it == 1 }
+        }
+        assertEquals(1, specialMutableStateFlow.value)
+    }
+    @Test
+    fun specialTest() {
+        val specialMutableStateFlow = SpecialMutableStateFlow(0)
+        runTest {
+            lateinit var subscriberJob: Job
+            subscriberJob = specialMutableStateFlow.subscribe(this) {
+                when (it) {
+                    1 -> specialMutableStateFlow.value = 2
+                    2 -> subscriberJob.cancel()
+                }
+            }
+            specialMutableStateFlow.value = 1
+            subscriberJob.join()
+        }
+        assertEquals(2, specialMutableStateFlow.value)
+    }
+}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index a524c01bc50..c28a0158cd1 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -2,18 +2,18 @@
 
 kt = "1.9.23"
 kt-serialization = "1.6.3"
-kt-coroutines = "1.8.0"
+kt-coroutines = "1.8.1"
 
-kslog = "1.3.3"
+kslog = "1.3.4"
 
 jb-compose = "1.6.2"
-jb-exposed = "0.50.0"
+jb-exposed = "0.50.1"
 jb-dokka = "1.9.20"
 
 korlibs = "5.4.0"
 uuid = "0.8.4"
 
-ktor = "2.3.10"
+ktor = "2.3.11"
 
 gh-release = "2.5.2"
 
@@ -26,7 +26,7 @@ kotlin-poet = "1.16.0"
 
 versions = "0.51.0"
 
-android-gradle = "8.4.0"
+android-gradle = "8.3.2"
 dexcount = "4.0.0"
 
 android-coreKtx = "1.13.1"
diff --git a/ktor/client/build.gradle b/ktor/client/build.gradle
index bea1eee5581..a3e994d247d 100644
--- a/ktor/client/build.gradle
+++ b/ktor/client/build.gradle
@@ -15,9 +15,6 @@ kotlin {
                 api libs.ktor.client
             }
         }
-        androidMain {
-            dependsOn jvmMain
-        }
 
         linuxX64Main {
             dependencies {
diff --git a/ktor/common/build.gradle b/ktor/common/build.gradle
index 59af6eb7af8..9f1a98fd5bd 100644
--- a/ktor/common/build.gradle
+++ b/ktor/common/build.gradle
@@ -16,8 +16,5 @@ kotlin {
                 api libs.ktor.io
             }
         }
-        androidMain {
-            dependsOn jvmMain
-        }
     }
 }
diff --git a/language_codes/build.gradle b/language_codes/build.gradle
index 41e41961f03..d425197852e 100644
--- a/language_codes/build.gradle
+++ b/language_codes/build.gradle
@@ -5,11 +5,3 @@ plugins {
 }
 
 apply from: "$mppJvmJsAndroidLinuxMingwLinuxArm64ProjectPresetPath"
-
-kotlin {
-    sourceSets {
-        androidMain {
-            dependsOn jvmMain
-        }
-    }
-}
diff --git a/language_codes/src/commonMain/kotlin/dev/inmo/micro_utils/language_codes/LanguageCodes.kt b/language_codes/src/commonMain/kotlin/dev/inmo/micro_utils/language_codes/LanguageCodes.kt
index bff6adc83f9..2e28dfa8459 100644
--- a/language_codes/src/commonMain/kotlin/dev/inmo/micro_utils/language_codes/LanguageCodes.kt
+++ b/language_codes/src/commonMain/kotlin/dev/inmo/micro_utils/language_codes/LanguageCodes.kt
@@ -1,3 +1,5 @@
+@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE") // for suppressing of @Serializable(IetfLangSerializer::class) on inheritors of IetfLang
+
 package dev.inmo.micro_utils.language_codes
 
 import kotlinx.serialization.Serializable
diff --git a/mppJvmJsAndroidLinuxMingwLinuxArm64Project.gradle b/mppJvmJsAndroidLinuxMingwLinuxArm64Project.gradle
index e94f8e848c3..f70a1d5d842 100644
--- a/mppJvmJsAndroidLinuxMingwLinuxArm64Project.gradle
+++ b/mppJvmJsAndroidLinuxMingwLinuxArm64Project.gradle
@@ -60,6 +60,12 @@ kotlin {
                 implementation kotlin('test-junit')
             }
         }
+        nativeMain.dependsOn commonMain
+        linuxX64Main.dependsOn nativeMain
+        mingwX64Main.dependsOn nativeMain
+        linuxArm64Main.dependsOn nativeMain
+
+        androidMain.dependsOn jvmMain
     }
 }
 
diff --git a/mppJvmJsLinuxMingwLinuxArm64Project.gradle b/mppJvmJsLinuxMingwLinuxArm64Project.gradle
index b0cec0306a2..622393cf7e6 100644
--- a/mppJvmJsLinuxMingwLinuxArm64Project.gradle
+++ b/mppJvmJsLinuxMingwLinuxArm64Project.gradle
@@ -45,6 +45,13 @@ kotlin {
                 implementation kotlin('test-junit')
             }
         }
+
+        nativeMain.dependsOn commonMain
+        linuxX64Main.dependsOn nativeMain
+        mingwX64Main.dependsOn nativeMain
+        linuxArm64Main.dependsOn nativeMain
+
+        androidMain.dependsOn jvmMain
     }
 }
 
diff --git a/mppJvmJsLinuxMingwProject.gradle b/mppJvmJsLinuxMingwProject.gradle
index bbefe2b5817..b16cba2f6df 100644
--- a/mppJvmJsLinuxMingwProject.gradle
+++ b/mppJvmJsLinuxMingwProject.gradle
@@ -55,6 +55,10 @@ kotlin {
             }
         }
 
+        nativeMain.dependsOn commonMain
+        linuxX64Main.dependsOn nativeMain
+        mingwX64Main.dependsOn nativeMain
+
         androidMain.dependsOn jvmMain
     }
 }
diff --git a/mppProjectWithSerializationAndCompose.gradle b/mppProjectWithSerializationAndCompose.gradle
index 776cde94da1..a9be6b2cd7c 100644
--- a/mppProjectWithSerializationAndCompose.gradle
+++ b/mppProjectWithSerializationAndCompose.gradle
@@ -67,8 +67,6 @@ kotlin {
                 implementation libs.android.espresso
             }
         }
-
-        androidMain.dependsOn jvmMain
     }
 }
 
diff --git a/repos/common/build.gradle b/repos/common/build.gradle
index bf9c4a857da..8079f0b47e8 100644
--- a/repos/common/build.gradle
+++ b/repos/common/build.gradle
@@ -28,7 +28,6 @@ kotlin {
                 api internalProject("micro_utils.common")
                 api internalProject("micro_utils.coroutines")
             }
-            dependsOn jvmMain
         }
     }
 }
diff --git a/resources/build.gradle b/resources/build.gradle
index ba3a7ca9d9e..178fbdff3f5 100644
--- a/resources/build.gradle
+++ b/resources/build.gradle
@@ -13,9 +13,5 @@ kotlin {
                 api project(":micro_utils.language_codes")
             }
         }
-
-        androidMain {
-            dependsOn(jvmMain)
-        }
     }
 }