Inconsistency in API
Is your feature request related to a problem? Please describe.
The native payment SDK requires just app context. The card payment SDK involves activity.
Describe the solution you'd like.
I prefer application context to avoid leaks related to the configuration cache.
Thanks for all of the feedback @emartynov I'm taking note of a lot of these items. We have some feature development in progress at the moment that I've been told is high priority, but these issues will be extremely helpful going forward and I plan on addressing each one in the near future.
For this one, if there is an ideal API that you would like to see the PayPal SDK use please feel free to open a GitHub discussion and we can talk through specific design decisions we've made in the past, and how we'd like to improve the API going forward.
@sshropshire I don't have the ideal API picture and you are SDK people who see more usage cases.
The ticket was opened because I had to implement an additional component in the app to have a reference of the activity in some low-level component that I called the Paypal payment provider.
I was also surprised that the card payment requires the activity since both types are firing the web view and I didn't understand why activity context is critical.
@emartynov understood. We do iterate through our API decisions quite a bit as you've mentioned, but we do appreciate direct feedback.
We require an Activity reference in this instance in order to keep the browser switch Chrome Custom Tab (CCT) on the same task stack as the host activity. We may consider opening this up in the future to allow a Context only integration, with the only caveat being that the CCT will be launched in a separate tab.
@sshropshire Then why you don't require an activity for the Paypal native client?
The Activity launched by the PayPalNative flow is launched in a new task. We work internally with the PayPal native team, and they own the translucent Activity that's launched for the native flow. We have less control over the configuration of the CCT activity, but again we may offer the ability to launch with context-only in a future release to see how it affects the user experience.
Not sure if it might be related to the difference in the launch mode. But I submitted #178 today.