Skip to content

Conversation

noguier
Copy link

@noguier noguier commented Oct 7, 2025

Thank you for your contribution to Braintree.

Summary of changes

  • added AuthTabInternalClient, that support both AuthTab and ChromeCustomTab.
    Note: ACTIVITY_NEW_TASK is not supported for AuthTab
  • removed ChromeCustomTabsInternalClient,
  • modified ComposeActivity & DemoActivitySingleTop to accept the above changes. Added checks to use Authtab or ChromeCustomTab depending on the device
  • added toast visuals to see whether or not the AuthTab is supported
  • cleared intent data after handling incomplete browser switch to prevent displaying stale success data from a previous request

Checklist

  • Added a changelog entry

Authors

List GitHub usernames for everyone who contributed to this pull request.

saperi22 and others added 10 commits September 25, 2025 12:18
- Update AGP version to 8.9.1 -- requires update to gradle wrapper 8.11.1
- Update compile and target sdk to 36
added AuthTabInternalClient,
removed ChromeCustomTabsInternalClient,
modified ComposeActivity & DemoActivitySingleTop to accept the above changes,
added toast visuals to see whether or not the AuthTab is supported
rewrote AuthTabInternalClient to Kotlin and added a ClearTop Flag,
wrote new AuthTabInternalClientUnitTest,
removed ChromeCustomTabsInternalClientUnitTest,
modified BrowserSwitchClientUnitTest to accept the AuthTab changes
removed CustomTabIntentBuilder,
removed tests associated with CustomTabs from AuthTabInternalClientUnitTest,,
modified BrowserSwitchClientUnitTest to accept the AuthTab launchURL signature
-Testing the authtab flow on older devices without intents
This reverts commit e27cfa1.
This reverts commit 9803e43. Branching still needed to provide support for older devices.
 - added AuthTabInternalClient,
 -  removed ChromeCustomTabsInternalClient,
 -  modified ComposeActivity & DemoActivitySingleTop to accept the above changes,
 - added toast visuals to see whether or not the AuthTab is supported
@noguier noguier requested a review from a team as a code owner October 7, 2025 21:03
@tdchow
Copy link
Contributor

tdchow commented Oct 8, 2025

I was thinking of potential ways to streamline the integration steps for Browser Switch with Auth Tab.

What if we removed the exposed AuthTabCallback used for the Auth Tab flow, but internally set the AuthTabIntent.registerActivityResultLauncher. When the launcher callback is invoked with a result, we could store it in the BrowserSwitchClient class and use that result when the caller of the SDK invokes BrowserSwitchClient.completeRequest(), instead of the passed in intent.

This way the caller of the Browser Switch SDK does not need to add additional logic for AuthTab and can use the existing API interface.

@noguier @saperi22 - I haven't completely vetted this approach but wanted to get your thoughts!

edit: This makes the assumption that the AuthTabIntent.registerActivityResultLauncher is invoked before onResume or onNewIntent in the calling Activity. I ran a few tests and this seems to be the behavior.

@tdchow
Copy link
Contributor

tdchow commented Oct 8, 2025

Chatted with @noguier on a call regarding my above comment and determined that the changes should be outside of the scope of this PR. We'll create a follow up ticket to investigate.

@saperi22
Copy link
Contributor

saperi22 commented Oct 9, 2025

This makes the assumption that the AuthTabIntent.registerActivityResultLauncher is invoked before onResume or onNewIntent in the calling Activity. I ran a few tests and this seems to be the behavior.

I'm not sure if this is always true. Any official documentation on this would be great, but there's also not enough information to be pushing back on this right now.

@saperi22
Copy link
Contributor

saperi22 commented Oct 9, 2025

@noguier we could probably add detekt in one of our future PRs to catch some styling issues.

@noguier
Copy link
Author

noguier commented Oct 9, 2025

@saperi22 regarding @tdchow quote here:

This makes the assumption that the AuthTabIntent.registerActivityResultLauncher is invoked before onResume or onNewIntent in the calling Activity. I ran a few tests and this seems to be the behavior.

Based on this section, specifically :

Before launching an Auth Tab, declare an ActivityResultLauncher that takes an ActivityResultCaller as well as an ActivityResultCallback. This is done before the activity or fragment is created.

So, to my understanding as long as we call registerActivityResultLauncher in onCreate, Tim's assumption will always hold. Please, correct me if I am wrong.

Copy link
Contributor

@tdchow tdchow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good! just had a few non blocking comments.

@noguier noguier merged commit cc39a8a into auth-tab-feature Oct 10, 2025
2 checks passed
@noguier noguier deleted the ana-dev branch October 10, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants