-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Replaced by #81 |
Summary of changes
FragmentActivity
parameters toComponentActivity
. This is more compatible with Jetpack Compose integrations, and we don't use any specificFragmentActivity
features within the SDK, so we don't need to require itChecklist
Authors