diff options
Diffstat (limited to 'mobile/android/android-components/components/concept/engine/src')
6 files changed, 127 insertions, 63 deletions
diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationEngineState.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationEngineState.kt index 1885c650a4..faa1513ec9 100644 --- a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationEngineState.kt +++ b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationEngineState.kt @@ -10,6 +10,7 @@ package mozilla.components.concept.engine.translate * @property detectedLanguages Detected information about preferences and page information. * @property error If an error state occurred or an error was reported. * @property isEngineReady If the translation engine is primed for use or will need to be loaded. +* @property hasVisibleChange If the browser has visibly started showing the translation. * @property requestedTranslationPair The language pair to translate. Usually populated after first request. */ @@ -17,6 +18,7 @@ data class TranslationEngineState( val detectedLanguages: DetectedLanguages? = null, val error: String? = null, val isEngineReady: Boolean? = false, + val hasVisibleChange: Boolean? = false, val requestedTranslationPair: TranslationPair? = null, ) diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationOperation.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationOperation.kt index 0f9b62029f..28dfd8b80c 100644 --- a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationOperation.kt +++ b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/translate/TranslationOperation.kt @@ -36,6 +36,13 @@ enum class TranslationOperation { FETCH_PAGE_SETTINGS, /** + * Fetch the translations offer setting. + * Note: this request is also encompassed in [FETCH_PAGE_SETTINGS], but intended for checking + * fetching for global settings or when only this setting is needed. + */ + FETCH_OFFER_SETTING, + + /** * Fetch the user preference on whether to offer, always translate, or never translate for * all supported language settings. */ diff --git a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webextension/WebExtensionDelegate.kt b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webextension/WebExtensionDelegate.kt index fce18e3863..a2e8b18699 100644 --- a/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webextension/WebExtensionDelegate.kt +++ b/mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/webextension/WebExtensionDelegate.kt @@ -49,6 +49,13 @@ interface WebExtensionDelegate { fun onReady(extension: WebExtension) = Unit /** + * Invoked when optional permissions for a web extension have changed. + * + * @param extension The [WebExtension] for which permissions have changed. + */ + fun onOptionalPermissionsChanged(extension: WebExtension) = Unit + + /** * Invoked when a web extension in private browsing allowed is set. * * @param extension the modified [WebExtension] instance. diff --git a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/example_mdn.json b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/example_mdn.json index d08b78f9b7..4e6b1d6a98 100644 --- a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/example_mdn.json +++ b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/example_mdn.json @@ -5,33 +5,42 @@ "display": "standalone", "background_color": "#ffffff", "description": "A simply readable Hacker News app.", - "icons": [{ - "src": "images/touch/homescreen48.png", - "sizes": "48x48", - "type": "image/png" - }, { - "src": "images/touch/homescreen72.png", - "sizes": "72x72", - "type": "image/png" - }, { - "src": "images/touch/homescreen96.png", - "sizes": "96x96", - "type": "image/png" - }, { - "src": "images/touch/homescreen144.png", - "sizes": "144x144", - "type": "image/png" - }, { - "src": "images/touch/homescreen168.png", - "sizes": "168x168", - "type": "image/png" - }, { - "src": "images/touch/homescreen192.png", - "sizes": "192x192", - "type": "image/png" - }], - "related_applications": [{ - "platform": "play", - "url": "https://play.google.com/store/apps/details?id=cheeaun.hackerweb" - }] + "icons": [ + { + "src": "images/touch/homescreen48.png", + "sizes": "48x48", + "type": "image/png" + }, + { + "src": "images/touch/homescreen72.png", + "sizes": "72x72", + "type": "image/png" + }, + { + "src": "images/touch/homescreen96.png", + "sizes": "96x96", + "type": "image/png" + }, + { + "src": "images/touch/homescreen144.png", + "sizes": "144x144", + "type": "image/png" + }, + { + "src": "images/touch/homescreen168.png", + "sizes": "168x168", + "type": "image/png" + }, + { + "src": "images/touch/homescreen192.png", + "sizes": "192x192", + "type": "image/png" + } + ], + "related_applications": [ + { + "platform": "play", + "url": "https://play.google.com/store/apps/details?id=cheeaun.hackerweb" + } + ] } diff --git a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/spec_typical.json b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/spec_typical.json index 3f180353eb..82aeb2c95f 100644 --- a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/spec_typical.json +++ b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/spec_typical.json @@ -4,17 +4,21 @@ "name": "Super Racer 3000", "description": "The ultimate futuristic racing game from the future!", "short_name": "Racer3K", - "icons": [{ - "src": "icon/lowres.webp", - "sizes": "64x64", - "type": "image/webp" - },{ - "src": "icon/lowres.png", - "sizes": "64x64" - }, { - "src": "icon/hd_hi", - "sizes": "128x128" - }], + "icons": [ + { + "src": "icon/lowres.webp", + "sizes": "64x64", + "type": "image/webp" + }, + { + "src": "icon/lowres.png", + "sizes": "64x64" + }, + { + "src": "icon/hd_hi", + "sizes": "128x128" + } + ], "scope": "/racer/", "start_url": "/racer/start.html", "display": "fullscreen", @@ -26,26 +30,34 @@ "scope": "/racer/", "update_via_cache": "none" }, - "screenshots": [{ - "src": "screenshots/in-game-1x.jpg", - "sizes": "640x480", - "type": "image/jpeg" - },{ - "src": "screenshots/in-game-2x.jpg", - "sizes": "1280x920", - "type": "image/jpeg" - }], - "related_applications": [{ - "platform": "play", - "url": "https://play.google.com/store/apps/details?id=com.example.app1", - "id": "com.example.app1", - "min_version": "2", - "fingerprints": [{ - "type": "sha256_cert", - "value": "92:5A:39:05:C5:B9:EA:BC:71:48:5F:F2" - }] - }, { - "platform": "itunes", - "url": "https://itunes.apple.com/app/example-app1/id123456789" - }] + "screenshots": [ + { + "src": "screenshots/in-game-1x.jpg", + "sizes": "640x480", + "type": "image/jpeg" + }, + { + "src": "screenshots/in-game-2x.jpg", + "sizes": "1280x920", + "type": "image/jpeg" + } + ], + "related_applications": [ + { + "platform": "play", + "url": "https://play.google.com/store/apps/details?id=com.example.app1", + "id": "com.example.app1", + "min_version": "2", + "fingerprints": [ + { + "type": "sha256_cert", + "value": "92:5A:39:05:C5:B9:EA:BC:71:48:5F:F2" + } + ] + }, + { + "platform": "itunes", + "url": "https://itunes.apple.com/app/example-app1/id123456789" + } + ] } diff --git a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/twitter_mobile.json b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/twitter_mobile.json index 142ce0317e..2f661ffc34 100644 --- a/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/twitter_mobile.json +++ b/mobile/android/android-components/components/concept/engine/src/test/resources/manifests/twitter_mobile.json @@ -1 +1,28 @@ -{"background_color":"#ffffff","description":"It's what's happening. From breaking news and entertainment, sports and politics, to big events and everyday interests.","display":"standalone","gcm_sender_id":"49625052041","gcm_user_visible_only":true,"icons":[{"src":"https://abs.twimg.com/responsive-web/web/icon-default.604e2486a34a2f6e1.png","sizes":"192x192","type":"image/png"},{"src":"https://abs.twimg.com/responsive-web/web/icon-default.604e2486a34a2f6e1.png","sizes":"512x512","type":"image/png"}],"name":"Twitter","share_target":{"action":"compose/tweet","params":{"title":"title","text":"text","url":"url"}},"short_name":"Twitter","start_url":"/","theme_color":"#ffffff","scope":"/"} +{ + "background_color": "#ffffff", + "description": "It's what's happening. From breaking news and entertainment, sports and politics, to big events and everyday interests.", + "display": "standalone", + "gcm_sender_id": "49625052041", + "gcm_user_visible_only": true, + "icons": [ + { + "src": "https://abs.twimg.com/responsive-web/web/icon-default.604e2486a34a2f6e1.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "https://abs.twimg.com/responsive-web/web/icon-default.604e2486a34a2f6e1.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "name": "Twitter", + "share_target": { + "action": "compose/tweet", + "params": { "title": "title", "text": "text", "url": "url" } + }, + "short_name": "Twitter", + "start_url": "/", + "theme_color": "#ffffff", + "scope": "/" +} |