-
Notifications
You must be signed in to change notification settings - Fork 236
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
Allow processing browser switch redirect without requiring an Activity instance #941
Comments
Another alternative option: It looks like I can just construct my own |
Hey @erawhctim thanks for the request. We're working on a It's worth calling out that application-context-enabled browser switching will force the Chrome Custom Tab (CCT) to be launched in a new task and there is no way to close the custom tab browser programmatically, so the CCT window will dangle in the user's task manager until they close it. If you would like to provide more information about your use-case please do as well, or we may reach out when the beta is ready to see if it's something your app can use. |
Good to know, thanks for the response! I can give you some more details on how our screens/PayPal usage is set up, maybe there's an alternative SDK usage that you can pinpoint that I've missed: We have a main activity that hosts mostly all screens, and we have a few additional Activities that are presented modally on top of the main activity. We have a few payment-related Fragments that can exist within either the main Activity or one of the misc. modally-presented Activities (depending on the UI flow), and those Fragments need to initiate the "vault" flow for vaulting a PayPal account (via Our main Activity is configured with |
@erawhctim got it so the PayPal vault Fragment parent activity may be one of several possible Activity subclasses provided by your app? The vault Fragment should be able to access the parent activity by using There may be away to handle this in the current version using custom URL schemes. Either way we may offer application-context enabled browser switching in the future, so it's helpful to know what the dream scenario is for your particular app architecture. |
Exactly right! This is the strategy we landed on, and it's working well in our testing (but configuring each Activity with it's own Activity-scoped SDK and manifest declaration is a bit of a pain). Browser switching via App Context might ease that burden slightly, but the current setup is totally manageable (given we don't add new screens with PayPal support very often). Thanks for the help thinking through this 🤝 |
@erawhctim we've released v5 where |
Is your feature request related to a problem? Please describe.
The problem is a scoping issue:
PayPalClient
is effective Activity-scoped, since it needs anActivity
reference in its constructor, butonBrowserSwitchResult()
doesn't actually need an Activity reference at all and could be Application-scoped.Describe the solution you'd like.
I'd like to separate concerns of the
PayPalClient
(and it's underlying dependencies,BraintreeClient
andBrowserSwitchClient
) a bit so that I can callPayPalClient.onBrowserSwitchResult()
without requiring an Activity instance.From what I can tell,
BraintreeClient
andBrowserSwitchClient
can both satisfy the needs ofonBrowserSwitchResult()
with only aContext
reference (since they end up callingContext.getApplicationContext()
internally), but since is routed through thePayPalClient
, there's no way to callonBrowserSwitchResult()
today without requiring an Activity.If I could just construct a
BraintreeClient
and callBraintreeClient.onBrowserSwitchResult()
directly, that would work (but that function is restricted/internal).My use case revolves around certain UI screens that observe the results of the browser redirect being re-used in multiple Activities, depending on which app flow originated the PayPal account creation flow. I would prefer to handle the browser redirects and forward them into the SDK in one place (in a
BroadcastReceiver
or some other Application-scoped object) instead of configuring the browser redirect to work with multiple Activities, but that doesn't seem possible today.My ideal solution(s):
onBrowserSwitchResult()
part of thePayPayClient
into some new object (e.g.PayPalBrowserRedirectClient
) that only requires aContext
PayPalClient
as-is, and offer a different way to send browser redirect results into theBraintreeClient
or its underlyingBrowserSwitchClient
The text was updated successfully, but these errors were encountered: