-
Notifications
You must be signed in to change notification settings - Fork 300
Embedded components #2193
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
base: master
Are you sure you want to change the base?
Embedded components #2193
Conversation
maragues-stripe
left a comment
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.
I focused on the Android part
android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt
Outdated
Show resolved
Hide resolved
| val uri = android.net.Uri.parse(url) | ||
| val builder = | ||
| androidx.browser.customtabs.CustomTabsIntent | ||
| .Builder() | ||
|
|
||
| // Set toolbar color for better UX | ||
| builder.setShowTitle(true) | ||
| builder.setUrlBarHidingEnabled(true) | ||
|
|
||
| val customTabsIntent = builder.build() |
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.
nit: You can probably move this outside of runOnUiThread
| if (manifestFile.exists()) { | ||
| def manifest = manifestFile.text | ||
|
|
||
| // Add launchMode="singleTask" |
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.
MainActivity with launchMode=singleTask will destroy all activities that previously existed on top of it.
Is that what we want?
In any case, can't we define a standard AndroidManifest.xml file, instead of doing this?
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.
launchMode=singleTask is necessary for deep linking with React Navigation:
https://reactnavigation.org/docs/deep-linking/#setup-on-android
And deep linking is necessary for using "secure webviews" (implemented with chrome tabs on Android) to return back to the app.
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.
And we can't use AndroidManifest.xml file, instead of modifying the manifest in the build.gradle?
Co-authored-by: maragues-stripe <[email protected]>
Summary
This PR adds support for Connect embedded components. In particular it adds support for 3 components:
New components can easily be added.
Most of the work is done using just React Native but I need to use native code for a couple of things:
Question: this API is not ready for GA yet. How do we prevent users to think it's production ready? Should I add an
unstable_prefix or aPrivatePreviewsuffix to the API or something like that?Motivation
https://docs.google.com/document/d/1tEm_mtsbHgbyhBoctYGLjmmLth0nI4b24osTIxN8_gM/edit?usp=sharing
Testing
I updated the backend to have an additional endpoint to return a client secret for the embedded components and added 3 screens to the example app.
Documentation
Select one: