FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

Add way to differentiate between "canceled by user" and "canceled by system"

Open edenman opened this issue 4 years ago • 0 comments

Steps to reproduce:

  1. I have one activity in my app, MainActivity, it has android:launchMode="singleTask"
  2. When MainActivity launches, if you are not logged in, I do startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().etc
  3. In onActivityResult I check the result code, if it's not RESULT_OK I look for an error with IdpResponse.fromResultIntent(data) and if there isn't one, I consider this a "canceled" result and I call MainActivity.finish()
  4. I'm adding deep link handling to MainActivity with a intent-filter tag in the manifest, but this is problematic if the user clicks on a link when they are not logged in. The stack looks like MainActivity->com.firebase.ui.auth.KickoffActivity. Because of singleTask, the KickoffActivity gets finished and it returns a RESULT_CANCELED with no IdpResponse. Unfortunately, this means we call finish() 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.

edenman avatar Jul 26 '21 23:07 edenman