Bug 1878921 - Translations CouldNotLoadLanguagesError UI "Try Again"

fenix/125.0
iorgamgabriel 3 months ago committed by mergify[bot]
parent dbb3c610a2
commit 936bb85d6c

@ -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) {

Loading…
Cancel
Save