Commit Graph

333 Commits

Author SHA1 Message Date
ohall-m
6cd07c8608 Bug 1892715 - Part 3: Update Android Components isTranslated Logic r=android-reviewers,giorga
This patch updates Android Components to use the new `hasVisibleChange `
information from the translations engine to better manage translations visible state.

Differential Revision: https://phabricator.services.mozilla.com/D209577
2024-05-07 23:39:55 +00:00
Jeff Boek
6a8372ee6c Bug 1889066 - Adds property to LoadUrlAction to determine if we should include a parentEngineSession when loading a URL r=android-reviewers,amejiamarmol
Differential Revision: https://phabricator.services.mozilla.com/D206815
2024-05-07 16:14:10 +00:00
Gabriel Luong
e1a1f56f90 Bug 1885628 - Part 3: Refactor getProperUrl into an extension function TabSessionState.getUrl r=android-reviewers,harrisono
- This refactors `getProperUrl` that was introduced in https://github.com/mozilla-mobile/fenix/pull/16181 into an extension function that lives in AC.
- This function will fetch the correct URL to be used when handling features such as bookmarks or share regardless of what mode the browser might be in (e.g. Reader mode).

Differential Revision: https://phabricator.services.mozilla.com/D208215
2024-05-05 08:20:45 +00:00
ohall-m
e4cbdc0856 Bug 1881814 - Translations AC Action to Update Language Preferences r=android-reviewers,giorga
This patch adds the option to update the user's language settings from a global perspective.

* Adds `TranslationsAction.UpdateLanguageSettingsAction` to update the language setting.
  * `TranslationsStateReducer` proactively accepts updates and is set on the translations engine or else the state is rolled back in `TranslationsMiddleware`.
* Refactors `updateLanguageSetting` in `TranslationsMiddleware` to handle both the page setting and global setting perspective.

Differential Revision: https://phabricator.services.mozilla.com/D208755
2024-04-29 14:02:41 +00:00
ohall-m
6deba21e0b Bug 1892743 - Add Global Translations Offer AC Options r=android-reviewers,giorga
Right now, it is only possible to access the “offer to translate” setting off of page settings. Unlike most of the other page settings, this setting is also a global setting.
This patch adds an option to view this setting independently of page settings and helps keep it in sync, when page settings change this setting as well.

We need this because it will soon be possible to access the global settings layer of settings directly via the main menu settings.

This patch:
* Adds `SetGlobalOfferTranslateSettingAction` - Sets the `offerTranslation` value on the global `TranslationsBrowserState`. Intended for global usage.
* Adds `UpdateGlobalOfferTranslateSettingAction` - A global way to update the offer to translate value outside of a page.
* Adds `TranslationOperation.FETCH_OFFER_SETTING` - The same as `SetGlobalOfferTranslateSettingAction`, but for a tab. Intended for tab usage.
* Adds a call to set `offerTranslation` on `Init`

Differential Revision: https://phabricator.services.mozilla.com/D208233
2024-04-24 13:31:05 +00:00
ohall-m
d4dbb0322c Bug 1881611 - Migrate Android Translations "Could never translate this site" to Global state r=android-reviewers,giorga
This patch makes a few modifications:
* Migrates `TranslationsState.neverTranslateSites` (session) to `TranslationsBrowserState.neverTranslateSites` (global browser)
* Behavior change: Can no longer update page settings when this list changes, because we have limited info on the session.
* Fetches `neverTranslateSites` information initially on app startup.

Differential Revision: https://phabricator.services.mozilla.com/D208031
2024-04-22 18:19:22 +00:00
Iulian Moraru
bbbd8ed40c Backed out changeset 84ea5c275334 (bug 1889066) for causing Engine related android build bustages. CLOSED TREE 2024-04-22 21:10:25 +03:00
Jeff Boek
eeac00117e Bug 1889066 - Adds property to LoadUrlAction to determine if we should include a parentEngineSession when loading a URL r=android-reviewers,amejiamarmol
Differential Revision: https://phabricator.services.mozilla.com/D206815
2024-04-22 16:00:20 +00:00
iorgamgabriel
8306f76ccf Bug 1885125 - The translation bottom sheet should not be displayed after dismissing it. r=android-reviewers,ohall,gl
Differential Revision: https://phabricator.services.mozilla.com/D206650
2024-04-08 06:17:26 +00:00
ohall-m
fb7d530978 Bug 1885336 - Part 2: Couldn't Load Languages did not show when Expected r=android-reviewers,giorga,gl
This patch fixes showing the Couldn't Load Languages translation error.
Part 1 of this series ensures the translations engine re-queries the language.

This patch:
* Fixes a `var` v. `val` recommendation
* Reorganized error handling
    * Session errors have priority over browser errors
    * Ensures null errors are also sent to clear state
* Proactively requests languages again when the dialog reopens and ensures error state

Differential Revision: https://phabricator.services.mozilla.com/D205473
2024-04-01 13:25:22 +00:00
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