This should be better than launching a new thread after LaunchedEffect already lauched hers.
This commit is contained in:
+2
-1
@@ -65,6 +65,7 @@ import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
|
|||||||
import com.vitorpamplona.quartz.events.ImmutableListOfLists
|
import com.vitorpamplona.quartz.events.ImmutableListOfLists
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -367,7 +368,7 @@ fun TranslateAndWatchLanguageChanges(
|
|||||||
LaunchedEffect(accountState) {
|
LaunchedEffect(accountState) {
|
||||||
// This takes some time. Launches as a Composition scope to make sure this gets cancel if this
|
// This takes some time. Launches as a Composition scope to make sure this gets cancel if this
|
||||||
// item gets out of view.
|
// item gets out of view.
|
||||||
launch(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
LanguageTranslatorService.autoTranslate(
|
LanguageTranslatorService.autoTranslate(
|
||||||
content,
|
content,
|
||||||
accountViewModel.account.dontTranslateFrom,
|
accountViewModel.account.dontTranslateFrom,
|
||||||
|
|||||||
Reference in New Issue
Block a user