When the popup doesn't fit up or down, because both availableHeightToTop and availableHeightToBottom are both smaller than containerHeight choose the highest one to choose menu direction.
Differential Revision: https://phabricator.services.mozilla.com/D205207
To ensure that we can build offline, we need to prevent gradle from
going through remote maven repos directly.
That means also overriding the default plugin repository
(plugins.gradle.org) in the `pluginManagement` section.
Differential Revision: https://phabricator.services.mozilla.com/D201497
This patch adds functionality for fetching global language settings for
translations.
This patch adds:
* The Operation `FETCH_AUTOMATIC_LANGUAGE_SETTINGS` for fetching the global language
settings from the translation engine.
* `SetLanguageSettingsAction` to set the `languageSettings` on `TranslationsBrowserState`.
*Initialization occurs in `initializeBrowserStore'
* Updates page settings to call `FETCH_AUTOMATIC_LANGUAGE_SETTINGS` after a page level
language update. (These settings coordinate both globally and on a page level.)
This bug adds:
* When `TranslateExpectedAction` occurs, then calculate the expected
translations model download size.
More background: `TranslateExpectedAction` indicates we have a default
`from` (page language) and a default `to` (user preferred) language
to initialize the translations dialog with expected values.
This queries how large of a download the translation
pair will be eagerly, so we have an initial value for the default recommendation.
This bugs shifts around the initialization for the global store in translations.
Revised Flow:
* `InitAction` -> `InitTranslationsBrowserState`
* `InitTranslationsBrowserState`:
* Checks the engine support, if everything is in order, then finishes initialization on `initializeBrowserStore`.
* A subtle bug was introduced when page settings were moved from `val` to
`var` for updating page settings.
* Everything works as expected with the reducer updating etc., however
changes on page settings are not observed in compose.
This patch refactors Translations `supportedLanguages` from `[SessionState.translationsState]`
to `[BrowserState.translationEngine]` in AC.
* Additionally adds `InitTranslationsBrowserState` to signal populating `[BrowserState.translationEngine]`.
* This patch also makes adjustments to migrates Fenix's `TranslationsDialogBinding` and `TranslationsBinding`
to also monitor this new store location.
This bug updates the logic for "never translate this language" and
"always translate this language" to ensure they are mutually exclusive
when one is true, but also allows them both to be false.
This patch fixes an issue where `isExpectedTranslate` is not cleared
between navigations. It adds logic in `TranslationsStateReducer` to
check if the criteria is met and clears the state, if applicable.
This patch adds a helper for converting BCP 47 codes to translations
supported languages.
Adds:
* `toLanguageMap` - maps a map of BCP 47 code (key) to Language (value)
* `findLanguage` - finds a language using the `toLanguageMap`
* `mapLanguageSettings` - makes a new display ready map for converting
the language settings from Map<String, LanguageSetting>?) to Map<Language?, LanguageSetting>