android-components / mozilla.components.feature.app.links / AppLinksFeature

AppLinksFeature

class AppLinksFeature : LifecycleAwareFeature (source)

This feature implements use cases for detecting and handling redirects to external apps. The user is asked to confirm her intention before leaving the app. These include the Android Intents, custom schemes and support for Intent.CATEGORY_BROWSABLE http(s) URLs.

In the case of Android Intents that are not installed, and with no fallback, the user is prompted to search the installed market place.

It provides use cases to detect and open links openable in third party non-browser apps.

It provides a RequestInterceptor to do the detection and asking of consent.

It requires: a Context, and a FragmentManager.

A Boolean flag is provided at construction to allow the feature and use cases to be landed without adjoining UI. The UI will be activated in https://github.com/mozilla-mobile/android-components/issues/2974 and https://github.com/mozilla-mobile/android-components/issues/2975.

Parameters

alwaysAllowedSchemes - List of schemes that will always be allowed to be opened in a third-party app even if interceptLinkClicks is false.

alwaysDeniedSchemes - List of schemes that will never be opened in a third-party app even if interceptLinkClicks is true.

Constructors

Name Summary
<init> AppLinksFeature(context: <ERROR CLASS>, sessionManager: SessionManager, sessionId: String? = null, interceptLinkClicks: Boolean = false, alwaysAllowedSchemes: Set<String> = setOf("mailto", "market", "sms", "tel"), alwaysDeniedSchemes: Set<String> = setOf("javascript"), fragmentManager: FragmentManager? = null, dialog: RedirectDialogFragment = SimpleRedirectDialogFragment.newInstance(), useCases: AppLinksUseCases = AppLinksUseCases(context))
This feature implements use cases for detecting and handling redirects to external apps. The user is asked to confirm her intention before leaving the app. These include the Android Intents, custom schemes and support for Intent.CATEGORY_BROWSABLE http(s) URLs.

Functions

Name Summary
start fun start(): Unit
Starts observing app links on the selected session.
stop fun stop(): Unit