diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt b/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt index af762dcc7..dce041c07 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/AuthCustomTabActivity.kt @@ -6,22 +6,25 @@ package org.mozilla.fenix.customtabs import mozilla.components.concept.sync.AccountObserver import mozilla.components.concept.sync.OAuthAccount -import mozilla.components.service.fxa.manager.FxaAccountManager import org.mozilla.fenix.ext.components +/** + * A special custom tab for signing into a Firefox Account. The activity is closed once the user is signed in. + */ class AuthCustomTabActivity : CustomTabActivity() { - private lateinit var accountManager: FxaAccountManager - // Navigate away from this activity when we have successful authentication private val accountStateObserver = object : AccountObserver { + /** + * Navigate away from this activity when we have successful authentication + */ override fun onAuthenticated(account: OAuthAccount, newAccount: Boolean) { - this@AuthCustomTabActivity.finish() + finish() } } override fun onResume() { super.onResume() - accountManager = this.components.backgroundServices.accountManager + val accountManager = components.backgroundServices.accountManager accountManager.register(accountStateObserver, this, true) } }