Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate FragmentActivity Parameters to ComponentActivity #76

Closed
wants to merge 3 commits into from

Conversation

sarahkoop
Copy link
Contributor

Summary of changes

  • Change all FragmentActivity parameters to ComponentActivity. This is more compatible with Jetpack Compose integrations, and we don't use any specific FragmentActivity features within the SDK, so we don't need to require it

Checklist

  • Added a changelog entry

Authors

@sarahkoop sarahkoop requested a review from a team as a code owner December 5, 2023 15:25
@@ -107,7 +107,7 @@ private boolean isValidRequestCode(int requestCode) {
*
* @param activity the activity that received the deep link back into the app
*/
public BrowserSwitchResult deliverResult(@NonNull FragmentActivity activity) {
public BrowserSwitchResult deliverResult(@NonNull ComponentActivity activity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey for BrowserSwitch v3 we may may be able to get rid of this method in favor of parseBrowserSwitchResult(). The hope is to make the manual browser switching flow mentioned in the migration guide the primary method of browser switching. It only needs a Context and an Intent instead of a particular Activity class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok yeah before v3 I'll do some more cleanup to see if we even want to support this pattern (and we are already using parseResult in core now). But it's the start method that is still requiring activity. The only place the method actually needs an activity currently is to check if the activity is finishing and throw an error. This check may not be as necessary now that we are giving more control to merchants over invoking the method - do you think we can remove it and change the start parameter to context as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yeah for start() I would definitely keep ComponentActivity. That's a really good point to make it Compose friendly.

It also makes sense to investigate turning Browser Switch into a launcher. That may help here, and apparently Compose has a launcher API that should simplify onCreate() instantiation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Only downside is we don't get a result back from Chrome Custom Tabs, but it does allow us to move away from Activity.startActivity(). It may be worth taking a look to see if it somehow makes sense for browser switching.

Copy link
Contributor

Choose a reason for hiding this comment

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

^ there's a lot to discuss here, we have a ton of options. For the most part if we go with parseResult() and start() for now we should be good.

@sarahkoop
Copy link
Contributor Author

Replaced by #81

@sarahkoop sarahkoop closed this Jan 19, 2024
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