From fb907033bb8475f30f532c6d740a92ddd78f5fad Mon Sep 17 00:00:00 2001 From: Tiger Oakes Date: Thu, 29 Aug 2019 15:36:46 -0400 Subject: [PATCH] Add comments to AuthCustomTabActivity --- .../fenix/customtabs/AuthCustomTabActivity.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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) } }