Skip to content

Commit ebfed96

Browse files
committed
fix: broadcast auth result directly to registered callbacks on async token exchange completion, revert unnecessary AuthenticationActivity changes, make internal fields private
1 parent d063324 commit ebfed96

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

auth0/src/main/java/com/auth0/android/provider/AuthenticationActivity.kt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import com.google.androidbrowserhelper.trusted.TwaLauncher
2020
public open class AuthenticationActivity : Activity() {
2121
private var intentLaunched = false
2222
private var customTabsController: CustomTabsController? = null
23-
private var returnedFromBrowser = false
2423
override fun onNewIntent(intent: Intent?) {
2524
super.onNewIntent(intent)
2625
setIntent(intent)
@@ -46,13 +45,6 @@ public open class AuthenticationActivity : Activity() {
4645
}
4746
}
4847

49-
override fun onStop() {
50-
super.onStop()
51-
if (intentLaunched) {
52-
returnedFromBrowser = true
53-
}
54-
}
55-
5648
override fun onResume() {
5749
super.onResume()
5850
val authenticationIntent = intent
@@ -65,15 +57,12 @@ public open class AuthenticationActivity : Activity() {
6557
launchAuthenticationIntent()
6658
return
6759
}
68-
val hasResult = authenticationIntent.data != null
69-
if (hasResult || returnedFromBrowser) {
70-
returnedFromBrowser = false
71-
if (!hasResult) {
72-
setResult(RESULT_CANCELED)
73-
}
74-
deliverAuthenticationResult(authenticationIntent)
75-
finish()
60+
val resultMissing = authenticationIntent.data == null
61+
if (resultMissing) {
62+
setResult(RESULT_CANCELED)
7663
}
64+
deliverAuthenticationResult(authenticationIntent)
65+
finish()
7766
}
7867

7968
override fun onDestroy() {

0 commit comments

Comments
 (0)