This bug adds `TranslationsRuntime.getNeverTranslateSiteList` and
`TranslationsRuntime.setNeverTranslateSpecifiedSite`
for use when managing the global never translate sites list.
Please continue to use `EngineSession.getNeverTranslateSiteSetting`
and `EngineSession.setNeverTranslateSiteSetting` when modifying this
same preference on the currently displayed site.
Fixed the current tests to pass.
The current tests are asserting implementation, so a new test was added
to test the behaviour by wrapping `NestedGeckoView` in a parent `View`
and counts the `onInterceptTouchEvent` calls it receives. When we are
in a gesture (starting with `ACTION_DOWN`) we deny the touch events to
the parent views until we receive a result from APZ.
Co-authored-by: Titouan Thibaud <tthibaud@mozilla.com>
With the current design, we have a `NestedGeckoView` inside this
`GeckoEngineView`. In our supported embedders, we wrap this with the
AndroidX `SwipeRefreshLayout` to enable features like Pull-To-Refresh:
```
SwipeRefreshLayout
└── GeckoEngineView
└── NestedGeckoView
```
`SwipeRefreshLayout` only looks at the direct child to see if it has
nested scrolling enabled. As we embed `NestedGeckoView` inside
`GeckoEngineView`, we change the hierarchy so that `NestedGeckoView`
is no longer the direct child of `SwipeRefreshLayout`.
To fix this we enable nested scrolling on the GeckoEngineView to
emulate this information. This is required information for
`View.requestDisallowInterceptTouchEvent` to work correctly in
the `NestedGeckoView`.
Co-authored-by: Titouan Thibaud <tthibaud@mozilla.com>
And invoke requestDisallowInterceptTouchEvent just before sending a new
ACTION_DOWN and invoke it againg just after receiving the result from
Gecko so that we can properly hold off triggering pull-to-refresh.
Re-initializing inputResultDetail on ACTION_UP or ACTION_CANCEL is
problematic since Gecko sends the result asynchronously thus it's
possible that Gecko sends the result after re-initialization on
ACTION_CANCEL.
Co-authored-by: Titouan Thibaud <tthibaud@mozilla.com>
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
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.
This patch adds some of the core runtime translations functionality
from GeckoView:
* `isTranslationsEngineSupported` - If the toolkit translation engine
is supported or not.
* `checkPairDownloadSize` - A way to check translation pair download
sizes before completing a translation operation.
* `listModelDownloadStates` - List download states of the language
models.
* `manageLanguageModel` - A way to manage the download state of
language models.
* `listSupportedLanguages` - List of supported languages.
* `preferredLanguages` - A list of the user's preferred languages.
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.