Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade NativeAppLoginMethodHandler to launch intents with ActivityLa…
…uncher Summary: When upgrading to AndroidX Activity/Fragment 1.5.1, if FB4A is not installed then the backup CCT flow will break. The following video is HB4A using Android Acitivty/Fragment 1.5.1 and reproducing the CCT problem. Note that nothing can be clicked on after the login flow is complete. Then clicking the back button says no permissions were granted. https://pxl.cl/2bHRd The root cause of the issue is that there were internal changes for the 1.5.1 update and using startActivityForResult does not trigger onActivityResult correctly. This seems to only happen when you try to start an activity when it doesn't exist. In NativeAppLoginMethodHandler, we can't tell if FB4A is installed so we just attempt to start the activity and catch the ActivityNotFoundException if it does not start. If the native flow cannot be attempted, then we fallback to CCT flow. For some reason, after failing to start the FB4A intent, the LoginFragment does not correctly trigger the onActivityResult function when the backup CCT flow completes. The error also seems to occur if you click cancel on the CCT flow. This diff updates the LoginFragment to have a new ActivityLauncher member and updates NativeAppLoginMethodHandler to use the launcher to launch the FB4A intent. We also now query for the intent instead of try/catch the start attempt. It seems this is the primary issue. In 1.4.0 and below, if an activity cannot be started, it will still trigger the on result flow. In 1.5.0 and above, if an activity cannot be started, it will not trigger the on result flow. Reviewed By: ct2mak Differential Revision: D38929817 (d7d4e0d) ------------------------------------------------------------------------ (from b985157050e1b9c68627c97055cd93d83f3c3752) fbshipit-source-id: ba7f62fcff18b734a047c7e88c09268f25d9db4a
- Loading branch information