2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Bug 1878921 - Translations CouldNotLoadLanguagesError UI "Try Again"

This commit is contained in:
iorgamgabriel 2024-02-23 17:23:46 +02:00 committed by mergify[bot]
parent dbb3c610a2
commit 936bb85d6c

View File

@ -29,6 +29,7 @@ import androidx.navigation.fragment.navArgs
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import mozilla.components.browser.state.store.BrowserStore
import mozilla.components.concept.engine.translate.TranslationError
import mozilla.components.lib.state.ext.observeAsComposableState
import mozilla.components.support.base.feature.ViewBoundFeatureWrapper
import org.mozilla.fenix.BrowserDirection
@ -212,7 +213,11 @@ class TranslationsDialogFragment : BottomSheetDialogFragment() {
onSettingClicked = onSettingClicked,
onLearnMoreClicked = { openBrowserAndLoad(learnMoreUrl) },
onPositiveButtonClicked = {
translationsDialogStore.dispatch(TranslationsDialogAction.TranslateAction)
if (state.error is TranslationError.CouldNotLoadLanguagesError) {
translationsDialogStore.dispatch(TranslationsDialogAction.FetchSupportedLanguages)
} else {
translationsDialogStore.dispatch(TranslationsDialogAction.TranslateAction)
}
},
onNegativeButtonClicked = {
if (state.isTranslated) {