|
|
|
@ -10,12 +10,16 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import mozilla.components.feature.accounts.FirefoxAccountsAuthFeature
|
|
|
|
|
import mozilla.components.feature.app.links.AppLinksInterceptor
|
|
|
|
|
import mozilla.components.service.fxa.manager.FxaAccountManager
|
|
|
|
|
import mozilla.components.support.ktx.android.content.hasCamera
|
|
|
|
|
import org.mozilla.fenix.Experiments
|
|
|
|
|
import org.mozilla.fenix.NavGraphDirections
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.components.metrics.Event
|
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
|
import org.mozilla.fenix.ext.getPreferenceKey
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
|
import org.mozilla.fenix.isInExperiment
|
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
|
import org.mozilla.fenix.test.Mockable
|
|
|
|
@ -28,6 +32,7 @@ class Services(
|
|
|
|
|
private val context: Context,
|
|
|
|
|
private val accountManager: FxaAccountManager
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
val fxaRedirectUrl = FxaServer.redirectUrl(context)
|
|
|
|
|
|
|
|
|
|
val accountsAuthFeature by lazy {
|
|
|
|
@ -42,6 +47,17 @@ class Services(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val appLinksInterceptor by lazy {
|
|
|
|
|
AppLinksInterceptor(
|
|
|
|
|
context,
|
|
|
|
|
interceptLinkClicks = true,
|
|
|
|
|
launchInApp = {
|
|
|
|
|
context.settings().preferences.getBoolean(
|
|
|
|
|
context.getPreferenceKey(R.string.pref_key_open_links_in_external_app), false)
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Launches the sign in and pairing custom tab from any screen in the app.
|
|
|
|
|
* @param context the current Context
|
|
|
|
|