11package io.tolgee
22
3- import com.rickclephas.kmp.nativecoroutines.NativeCoroutines
43import de.comahe.i18n4k.Locale
54import de.comahe.i18n4k.forLocaleTag
65import de.comahe.i18n4k.language
@@ -18,6 +17,7 @@ import io.tolgee.model.TolgeeMessageParams
1817import io.tolgee.model.TolgeeTranslation
1918import io.tolgee.storage.TolgeeStorageProvider
2019import kotlinx.atomicfu.atomic
20+ import kotlinx.coroutines.Dispatchers
2121import kotlinx.coroutines.ExperimentalCoroutinesApi
2222import kotlinx.coroutines.flow.Flow
2323import kotlinx.coroutines.flow.MutableSharedFlow
@@ -165,8 +165,10 @@ open class Tolgee(
165165 ).also {
166166 cachedTranslation.value = it
167167 changeFlow.emit(Unit )
168- changeListeners.forEach { listener ->
169- listener.onTranslationsChanged()
168+ withContext(Dispatchers .Main ) {
169+ changeListeners.forEach { listener ->
170+ listener.onTranslationsChanged()
171+ }
170172 }
171173 }
172174 }
@@ -198,7 +200,6 @@ open class Tolgee(
198200 */
199201 @JvmOverloads
200202 @OptIn(ExperimentalCoroutinesApi ::class )
201- @NativeCoroutines
202203 open fun tFlow (
203204 key : String ,
204205 parameters : TolgeeMessageParams = TolgeeMessageParams .None
@@ -211,7 +212,6 @@ open class Tolgee(
211212 }.filterNotNull()
212213
213214 @OptIn(ExperimentalCoroutinesApi ::class )
214- @NativeCoroutines
215215 open fun tArrayFlow (
216216 key : String
217217 ): Flow <List <String >> = localeFlow.mapLatest { locale ->
@@ -261,7 +261,6 @@ open class Tolgee(
261261 * This method is coroutine-safe and utilizes structured concurrency to manage asynchronous
262262 * operations.
263263 */
264- @NativeCoroutines
265264 open suspend fun preload () {
266265 suspendCatching { loadTranslations() }
267266 }
@@ -745,7 +744,7 @@ open class Tolgee(
745744 * Used for tracking plugin/integration usage.
746745 */
747746 internal const val TYPE_HEADER = " Compose Multiplatform"
748- internal const val VERSION_HEADER = " 1.0.0-alpha01 "
747+ internal const val VERSION_HEADER = " 1.0.0-SNAPSHOT "
749748
750749 /* *
751750 * Provides the locale of the system where the application is running.
0 commit comments