Runs the translation update in the main thread

This commit is contained in:
Vitor Pamplona
2023-06-28 14:52:01 -04:00
parent acfd687d74
commit 2326aa9f7c
@@ -296,7 +296,9 @@ fun TranslateAndWatchLanguageChanges(content: String, accountViewModel: AccountV
if (task.isSuccessful && content != task.result.result) {
if (task.result.sourceLang != null && task.result.targetLang != null) {
val preference = account.preferenceBetween(task.result.sourceLang!!, task.result.targetLang!!)
onTranslated(task.result, preference == task.result.sourceLang)
launch(Dispatchers.Main) {
onTranslated(task.result, preference == task.result.sourceLang)
}
}
}
}