Commit graph

323 commits

Author SHA1 Message Date
ohall-m
dd78da47e1 Bug 1885137 - Added Logging for if the Translation Engine is Supported
Added additional logging to know if the translations engine is supported
on the device.
2024-03-13 15:51:24 +00:00
ohall-m
4dc4264b42 Bug 1884459 - Prevent Offers to Translate after a Translation Occurs
This bug slightly adjusts the reducer to set `isOfferTranslate` to false
once a translation occurs.
2024-03-11 20:59:00 +00:00
Mark Hammond
7f8a575403 Bug 1879332 - ensure synced tabs includes the inactive property 2024-03-08 19:52:59 +00:00
ohall-m
bfceb71733 Bug 1878917 - Add Reducer for Checking for LanguageNotSupported and Send Error
This updates the translations session store to set an error when the
language is not supported.
2024-03-08 00:31:08 +00:00
ohall-m
adf4883c1f Bug 1883128 - Fix Logic Issue In Setting Page LanguageSettings
The language setting converter had an issue where it set to `NEVER`
instead of `OFFER`, which caused incorrect behavior.
2024-03-07 00:34:46 +00:00
jackyzy823
536a0f5fd3 Bug 1853107 - Fix a race condition on CreateEngineSession 2024-03-06 22:13:36 +00:00
t-p-white
d4300473fe Bug 1813913 - Added support for Custom Tabs setColorScheme & setColorSchemeParams API 2024-03-05 17:52:49 +00:00
ohall-m
6c6ae72bce Bug 1883127 - Clear isOfferTranslate Under Certain Conditions
This bug clears `isOfferTranslate` similarly to `isExpectedTranslate`
on a translations engine state change.
2024-03-04 20:47:29 +00:00
ohall-m
3c5b610023 Bug 1862291 - Operation for Fetching Global Language Settings
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.)
2024-03-04 20:04:01 +00:00
ohall-m
8b1a4d734e Bug 1882542 - Eagerly Calculate an Initial Translation Download Size
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.
2024-03-04 19:08:20 +00:00
Cathy Lu
9afba947ac Bug 1876820 - Add translation fetch downloaded languages action 2024-03-02 00:21:10 +00:00
ohall-m
67ecb461de Bug 1882403 - Refactor Browser Store Initialization for Translations
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`.
2024-02-29 22:23:15 +00:00
ohall-m
ca42258363 Bug 1882405 - Page Settings Data Structure Should be Val
* 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.
2024-02-29 03:30:23 +00:00
ohall-m
7e9ab07604 Bug 1880490 - Moving Translations supportedLanguages
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.
2024-02-27 22:52:14 +00:00
ohall-m
ed02882618 Bug 1882151 - Always and Never Page Settings Bug
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.
2024-02-27 21:43:40 +00:00
ohall-m
2a9c4f8c91 Bug 1881294 - Refine isExpectedTranslate
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.
2024-02-27 05:11:50 +00:00
ohall-m
ded496e876 Bug 1881604 - Helper for Transforming BCP 47 code to defined Language
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>
2024-02-26 17:00:24 +00:00
Alexandru2909
b133b2a157 Bug 1804636 - Allow search terms to be refined in content 2024-02-23 17:02:28 +00:00
mcarare
7562dc8765 Bug 1880077 - Switch to using Compose BOM instead of individual versioning 2024-02-22 08:51:53 +00:00
ohall-m
7c5f4177af Bug 1876803 - Translation Download Size Action
This patch adds a flow for determining the download size that would
occur for a given translation. Expected use case is for low-data modes.

* New `FetchTranslationDownloadSizeAction`
* New `SetTranslationDownloadSizeAction`
* New `CouldNotDetermineDownloadSizeError`
* New `TranslationDownloadSize` object and `translationDownloadSize` on the
session `TranslationsState`
2024-02-20 16:18:59 +00:00
ohall-m
afb67a9011 Bug 1877278 - AC Translations Check for if the Engine is Supported
This patch supports the workflow for checking if the device architecture supports translations.

This patch adds:
* New `TranslationsBrowserState` to hold global translations engine state
* New `SetEngineSupportedAction` to set the isEngineSupported value on `TranslationsBrowserState`
* New `EngineExceptionAction` to set errors on `TranslationsBrowserState`
2024-02-14 22:15:53 +00:00
ohall-m
bf47078f54 Bug 1877203 - Update Translations Page Settings
The goal of this bug is to have a way to update page settings.

It adds:
* A new action, `UpdatePageSettingAction`
  * This action has four options:
     * `UPDATE_ALWAYS_OFFER_POPUP`
     * `UPDATE_ALWAYS_TRANSLATE_LANGUAGE`
     * `UPDATE_NEVER_TRANSLATE_LANGUAGE`
     * `UPDATE_NEVER_TRANSLATE_SITE`
* Each operation eagerly sets the new setting on the browser store, then
sends the request to the engine. If setting on the engine fails, then
they will re-request the page settings in order to remain in-sync.
2024-02-13 23:34:22 +00:00
Cathy Lu
54f3780c23 Bug 1878962 - Action to remove site from never translate list 2024-02-13 22:20:42 +00:00
ohall-m
c5af172dbb Bug 1878365 - Translations AC Page Settings Bug
This patch updates:
* `requestTranslationPageSettings` is refactored to `requestPageSettings`
to match new naming conventions
* A missing dispatch in `TranslationsMiddleware` for
fetching page settings in `requestPageSettings`
* Corrects the test that was not blocking correctly that resulted in the
missing dispatch going unnoticed.
* Resets the error to null on `SetPageSettingsAction`
2024-02-08 22:28:31 +00:00
Cathy Lu
c16bcc5677 Bug 1876823 - Add action to fetch sites that should not be translated 2024-02-06 21:12:31 +00:00
ohall-m
ddd55b1a82 Bug 1877205 - Translations Fetch Supported Languages Refactor
This patch refactors a few things for fetching supported languages:

* `TranslateExpectedAction` is decoupled from fetching languages
* Now use `OperationRequestedAction` w/ `FETCH_SUPPORTED_LANGUAGES`
* Refactors the Fenix fragment to send `OperationRequestedAction` as a
placeholder for data initialization
* `TranslateSetLanguagesAction` is now `SetSupportedLanguagesAction`
2024-02-06 19:35:42 +00:00
Matthew Tighe
f3d0c9f39c Bug 1861459 - Update AppState.mode based on selected tab changes 2024-02-05 23:45:20 +00:00
ohall-m
c3e869fcaf Bug 1877588 - TranslationsMiddleware Dispatcher Scope Issue
This bug is to fix the `Must have a Handler` issue in the
TranslationsMiddleware when attempting to call using `Dispatcher.IO`.
2024-02-05 20:10:03 +00:00
ohall-m
14828a4bae Bug 1878091 - Translations Engine State and Translation Status Sync
This bug refines the reducer on a translations engine state change to
ensure the Fenix translations state and engine translations state are
in sync.
2024-02-05 17:17:11 +00:00
ohall-m
ea8eeac627 Bug 1875093 - Bug 1875093 - AC Action to Fetch and Set Page Preferences for Translations
This patch adds two new Actions:
* `OperationRequestedAction` - for requesting to fetch data
* `SetSettingsAction` - for setting that data on the browser store

`TranslationsMiddleware` reacts to these Actions by fetching and setting
the appropriate data.

The patch to update data will be bug 1877203.
2024-01-31 19:04:32 +00:00
jackyzy823
cf07aead87 Bug 1812359 - 'suspend' should also be applied to CustomTabs 2024-01-31 12:13:32 +00:00
ohall-m
259bc2d25e Bug 1876844 - Translations LanguageSetting Helper
This patch adds a way to convert between LanguageSetting and Booleans.
2024-01-30 14:51:35 +00:00
t-p-white
dfd07a262b Bug 1796209 - If config.toolbarColor is null use the toolbar 'menu' colour as a fallback 2024-01-30 12:33:45 +00:00
Cathy Lu
5d6ee304f1 Bug 1875106 - Add shopping api to send placement attribution event 2024-01-26 17:08:42 +00:00
ohall-m
b5fb43be66 Bug 1876567 - Fix Middleware Issue with Processing Translations States
This patch corrects an issue where `isTranslateProcessing` and
`isRestoreProcessing` states were not updating due to not sending along
pre-process actions in `EngineDelegateMiddleware`.
2024-01-25 23:43:14 +00:00
ohall-m
6df7a6ce6d Bug 1874441 - Connecting Dropdowns to Translate Button
This patch connects the translations to and from dropdowns to the
translation button and sets default dropdown selection values.
2024-01-25 21:42:43 +00:00
Makoto Kato
3cab535d70 Bug 1875225 - Part 1. Support <InputEncoding> element in search plugin. 2024-01-23 00:16:29 +00:00
t-p-white
01f1578630 Bug 1874861 - Removed redundant LongParameterList suppression's 2024-01-18 18:37:49 +00:00
Olivia Hall
3e5f9eac2a Bug 1873511 - New supportedLanguages and translationError on TranslationsState, with TranslateExceptionAction Refactor
This patch adds the additional state information of `supportedLanguages` and `translationError` to `TranslationsState`. The `supportedLanguages` are the languages the translation engine supports for translating for use in UI dropdowns. `translationError` is any error that occurred relating to translating.

`supportedLanguages` is currently set via an action that indicates the intention to translate on the new `EngineMiddleware` addition of `TranslationsMiddleware`. This patch also adds a new `TranslationOperation` of `FETCH_TO_AND_FROM_LANGUAGES` to indicate the process of getting `supportedLanguages`.

`translationError` is added to the `TranslationsState` to store errors as they arise. `TranslateExceptionAction` is also refactored from using the generic `Throwable` to the new `TranslationError` to accommodate `supportedLanguages` and better general error handling.O_AND_FROM_LANGUAGES` to indicate the process of getting `supportedLanguages`.
2024-01-11 20:58:52 +00:00
jackyzy823
572736f974 Bug 1812797 - Add referrerUrl to Request 2023-12-11 21:27:39 +00:00
Cathy Lu
9d9a2992d7 Bug 1858947 - Expose Shopping API reportBackInStock to AC 2023-12-06 18:53:24 +00:00
Cathy Lu
933fffe65f Bug 1866241 - Expose Shopping status progress field in AC 2023-12-01 16:06:07 +00:00
Olivia Hall
9308778aad Bug 1862262 - Translations Preferences
This bug adds a few options for translations preferences on the engine,
including:
* (Runtime Setting) Option to get/set translations offer popup
* (Runtime Request) Option to get/set translation language preference
* (Session Request) Option to get/set a site's translation preference
2023-11-30 23:00:07 +00:00
Olivia Hall
42b3883a45 Bug 1860844 - Add GeckoTranslateSessionDelegate to Android Components
This bug adds a translation session delegate for receiving information
from GeckoView on the state of the toolkit translation engine and also
when to expect and offer translations on a given page.

It also updates reference browser to use auto-detected defaults for
translating.
2023-11-21 22:24:04 +00:00
Olivia Hall
e842bb5c42 Bug 1844523 - Translate and Restore to Original Engine Support
This patch adds engine support for translate and restoring the page after
a translation. `requestTranslate` and `requestTranslationRestore` are
the Gecko engine session functions.

This corresponding actions for these functions are `TranslateAction`,
and `TranslateRestoreAction`. The success and failure correspond to the
actions `TranslateSuccessAction` and `TranslateExceptionAction`.

Sample usage is provided on reference browser. The sample is currently
hardcoded to support Spanish to English page translations until the next
API is introduced.
2023-11-03 21:10:32 +00:00
Cathy Lu
005e9f15fc Bug 1845835 - Expose shopping ad attribution events in AC 2023-11-02 19:04:16 +00:00
mcarare
93e973e94b Bug 1860725 - Revert "Bug 1812797 - Add referrerUrl to Request"
This reverts commit 9947b70d23127fedee50cb60d078e0a241b63ef4.
2023-10-24 15:40:34 +00:00
Lina Butler
c4350f91fe Bug 1858542 - Introduce AwesomeBarState and Suggestion.metadata.
This commit adds:

* An `AwesomeBarState` class to hold the currently visible suggestions
  and last clicked suggestion.
* `VisibilityStateUpdated` and `SuggestionClicked` `AwesomeBarAction`s
  to update the state, and an `EngagementFinished` action to reset the
  state. Consumers will dispatch these actions on the `BrowserStore`
  in response to user interactions with the awesomebar and toolbar.
* A `metadata` map to `AwesomeBar.Suggestion`, allowing providers to
  attach opaque data to each suggestion.
2023-10-24 07:43:07 +00:00
jackyzy823
d63fd3cf5a Bug 1812797 - Add referrerUrl to Request 2023-10-23 05:31:29 +00:00
rahulsainani
3d594a382d Bug 1857287 - Move isProductUrl to ContentState 2023-10-10 16:22:31 +00:00