Skip to content

Commit

Permalink
fix translation crash
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Jul 11, 2024
1 parent 0fe71ed commit 2afa0d1
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,23 @@ actual fun TranslateButton(
progress = false
enabled = false
}.addOnSuccessListener {
englishLocaleTranslator
.translate(text)
.addOnFailureListener {
progress = false
enabled = true
scopeCatching {
englishLocaleTranslator
.translate(text)
.addOnFailureListener {
progress = false
enabled = true

translated = false
onTranslation(null)
}.addOnSuccessListener {
progress = false
enabled = true
translated = false
onTranslation(null)
}.addOnSuccessListener {
progress = false
enabled = true

translated = true
onTranslation(it)
}
translated = true
onTranslation(it)
}
}.getOrNull()
}
}.getOrNull()
}
Expand Down

0 comments on commit 2afa0d1

Please sign in to comment.