mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
Runs the translation as a UI Scope instead of ViewModel's
This commit is contained in:
parent
19fb129f7c
commit
a2d38381b1
@ -322,7 +322,8 @@ fun TranslateAndWatchLanguageChanges(content: String, accountViewModel: AccountV
|
|||||||
val accountState by accountViewModel.accountLanguagesLiveData.observeAsState()
|
val accountState by accountViewModel.accountLanguagesLiveData.observeAsState()
|
||||||
|
|
||||||
LaunchedEffect(accountState) {
|
LaunchedEffect(accountState) {
|
||||||
accountViewModel.runOnIO {
|
// This takes some time. Launches as a Composition scope to make sure this gets cancel if this item gets out of view.
|
||||||
|
launch(Dispatchers.IO) {
|
||||||
LanguageTranslatorService.autoTranslate(
|
LanguageTranslatorService.autoTranslate(
|
||||||
content,
|
content,
|
||||||
accountViewModel.account.dontTranslateFrom,
|
accountViewModel.account.dontTranslateFrom,
|
||||||
|
Loading…
Reference in New Issue
Block a user