FirebaseUI-Android
FirebaseUI-Android copied to clipboard
Add way to differentiate between "canceled by user" and "canceled by system"
Steps to reproduce:
- I have one activity in my app,
MainActivity, it hasandroid:launchMode="singleTask" - When
MainActivitylaunches, if you are not logged in, I dostartActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().etc - In
onActivityResultI check the result code, if it's notRESULT_OKI look for an error withIdpResponse.fromResultIntent(data)and if there isn't one, I consider this a "canceled" result and I callMainActivity.finish() - I'm adding deep link handling to
MainActivitywith aintent-filtertag in the manifest, but this is problematic if the user clicks on a link when they are not logged in. The stack looks likeMainActivity->com.firebase.ui.auth.KickoffActivity. Because ofsingleTask, theKickoffActivitygets finished and it returns aRESULT_CANCELEDwith noIdpResponse. Unfortunately, this means we callfinish()and
Suggested Fix
Ideally there would be a way to differentiate between "canceled by user" and "canceled by the system as a result of singleTask"
Or if you have suggestions on how I should structure this, I'm all ears.