|
|
|
@ -11,6 +11,12 @@ import mozilla.components.service.fxa.manager.FxaAccountManager
|
|
|
|
|
import org.mozilla.fenix.settings.SupportUtils
|
|
|
|
|
import kotlin.coroutines.CoroutineContext
|
|
|
|
|
|
|
|
|
|
// The FirefoxAccountsAuthFeature provided by android components only worked with
|
|
|
|
|
// the tabs use case. We want to use our custom tab feature to improve the UX for both
|
|
|
|
|
// signing in through settings and onboarding.
|
|
|
|
|
|
|
|
|
|
// We're temporarily copying and creating our own:
|
|
|
|
|
// https://github.com/mozilla-mobile/android-components/issues/3272
|
|
|
|
|
class FirefoxAccountsAuthFeature(
|
|
|
|
|
private val accountManager: FxaAccountManager,
|
|
|
|
|
private val redirectUrl: String,
|
|
|
|
@ -32,7 +38,7 @@ class FirefoxAccountsAuthFeature(
|
|
|
|
|
CoroutineScope(coroutineContext).launch {
|
|
|
|
|
// FIXME return a fallback URL provided by Config...
|
|
|
|
|
// https://github.com/mozilla-mobile/android-components/issues/2496
|
|
|
|
|
val authUrl = beginAuthentication() ?: "https://accounts.firefox.com/signin"
|
|
|
|
|
val authUrl = beginAuthentication() ?: FALLBACK_URL
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
// We may fail to obtain an authentication URL, for example due to transient network errors.
|
|
|
|
@ -64,4 +70,8 @@ class FirefoxAccountsAuthFeature(
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
|
private const val FALLBACK_URL = "https://accounts.firefox.com/signin"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|