-
Notifications
You must be signed in to change notification settings - Fork 648
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
[Connect SDK] Support http/https pop-ups #9640
base: master
Are you sure you want to change the base?
Conversation
@@ -42,7 +42,7 @@ class SettingsService @Inject constructor(@ApplicationContext context: Context) | |||
fun getAppearanceIdFlow(): Flow<AppearanceInfo.AppearanceId?> { | |||
return observePref(APPEARANCE_ID_KEY) { prefs, key -> | |||
val appearanceId = prefs.getString(key, null) ?: return@observePref null | |||
AppearanceInfo.AppearanceId.valueOf(appearanceId) | |||
AppearanceInfo.AppearanceId.entries.firstOrNull { it.name == appearanceId } |
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.
👀 this fixes a crash if any appearance id's change and can't be found anymore (something I ran into myself)
Diffuse output:
APK
|
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.
The changes generally lgtm, but I think
- We should add some test coverage for the various cases (mailto, http, https, allow-listed, non-allowlisted)
- Please add a link to the PR description with the jira ticket for papertrail purposes 😄
view ?: return false // the view shouldn't be null, but if it is then don't handle the request | ||
val url = request?.url ?: return false // if the request isn't for a url, then don't handle it | ||
return if (url.host in ALLOWLISTED_HOSTS) { | ||
logger.warning("(StripeConnectWebViewClient) Received pop-up for allow-listed host: $url") |
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.
Is this a warning because we don't expect getting any of these given that messaging between windows on Android isn't supported? If this is the case, we should add a TODO here to add an analytic so we can setup alerts for it.
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 was going off of this in the spec: If host is allowlisted (connect.stripe.com or connect-js.stripe.com), print warning (stub out todo to log analytic error) because this isn't supported
Is that still accurate @mludowise-stripe? 👍 on adding an analytic here
logger.debug("(StripeConnectWebViewClient) Received unsupported pop-up request: $url") | ||
true // block the request as it's unsupported |
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.
Is this getting handled in MXMOBILE-2914? If so, should we add a TODO for it?
We have legitimate use cases for mailto urls, so we will need to handle this. A TODO would help clarify we're planning to do this in a followup PR 😄
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.
Yeah, good call
* A [WebChromeClient] that provides additional functionality for Stripe Connect Embedded Component WebViews. | ||
* | ||
* This class is currently empty, but it could be used to add additional functionality in the future | ||
* Setting a [WebChromeClient] (even an empty one) is necessary for certain functionality, like | ||
* [WebViewClient.shouldOverrideUrlLoading] to work properly. | ||
*/ |
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.
👍
@simond-stripe here are the equivalent test cases on iOS: |
Summary
http/https pop-ups are opened in a chrome custom tab and other pop-ups are unsupported.
Motivation
Certain embedded components rely on pop-ups for some functionality (ex. showing the user Stripe's privacy policy)
Testing
Screenshots
demo-1731711260.mp4