Skip to content
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] Update SDK API then Example app as needed #10330

Closed
wants to merge 10 commits into from

Conversation

lng-stripe
Copy link
Contributor

@lng-stripe lng-stripe commented Mar 6, 2025

Summary

Update the Connect SDK API and Example app following API review. Some API behavior was removed, so the Example app UX needed to be updated as appropriate:

  • Remove XML view setting
  • Remove example component Activities since we're only presenting DialogFragments (for now)
  • Apply edge-to-edge setting to the MainActivity due to the above.
  • Prompt to restart the app for edge-to-edge changes to take effect due to the above.

The diff is big, but it's mostly moving and deleting code. See inline comments.

Motivation

https://jira.corp.stripe.com/browse/CAX-3739
https://jira.corp.stripe.com/browse/CAX-3803

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2025-03-06.at.12.26.39.PM-compressed.mov

Copy link
Contributor

github-actions bot commented Mar 6, 2025

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed           │         uncompressed         
          ├───────────┬───────────┬───────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff  │ old       │ new       │ diff 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼──────
      dex │     2 MiB │     2 MiB │   0 B │   4.1 MiB │   4.1 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │   0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │   0 B │     8 KiB │     8 KiB │  0 B 
      res │ 302.6 KiB │ 302.6 KiB │   0 B │ 456.7 KiB │ 456.7 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │   0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   6.1 KiB │   6.1 KiB │   0 B │   5.9 KiB │   5.9 KiB │  0 B 
    other │  95.1 KiB │  95.1 KiB │ +11 B │ 182.2 KiB │ 182.2 KiB │  0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼──────
    total │   9.6 MiB │   9.6 MiB │ +11 B │  21.6 MiB │  21.6 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 20119 │ 20119 │ 0 (+0 -0) 
   types │  6224 │  6224 │ 0 (+0 -0) 
 classes │  5018 │  5018 │ 0 (+0 -0) 
 methods │ 30008 │ 30008 │ 0 (+0 -0) 
  fields │ 17362 │ 17362 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3643 │ 3643 │  0
APK
    compressed    │  uncompressed   │                                           
──────────┬───────┼──────────┬──────┤                                           
 size     │ diff  │ size     │ diff │ path                                      
──────────┼───────┼──────────┼──────┼───────────────────────────────────────────
 28.9 KiB │ +10 B │   64 KiB │  0 B │ ∆ META-INF/CERT.SF                        
  1.2 KiB │  +2 B │  1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA                       
    271 B │  -1 B │    120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
──────────┼───────┼──────────┼──────┼───────────────────────────────────────────
 30.4 KiB │ +11 B │ 65.3 KiB │  0 B │ (total)

@@ -115,7 +111,6 @@ fun ComponentPickerContent(
activity = context,
title = "Account Onboarding",
props = onboardingSettings.toProps(),
cacheKey = "AccountOnboardingExample"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 cacheKey is unnecessary for Controllers since there can only be one.

actions = {
IconButton(
onClick = {
onSave(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 Removed Save button in favor of save-on-change, since the UX is better with the toast.

Comment on lines -16 to +17
cacheKey: String? = null,
) : StripeComponentController<AccountOnboardingListener> by StripeComponentControllerImpl(
cls = AccountOnboardingDialogFragment::class.java,
) : StripeComponentController<AccountOnboardingListener, AccountOnboardingProps>(
dfClass = AccountOnboardingDialogFragment::class.java,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

  1. As mentioned above, cacheKey is not necessary for Controllers since there can only be one DialogFragment per component type.
  2. StripeComponentController was converted to an abstract class with its implementation was migrated from StripeComponentControllerImpl

@@ -89,7 +86,7 @@ class EmbeddedComponentManager(
* @param cacheKey Key to use for caching the internal WebView across configuration changes.
*/
@PrivateBetaConnectSDK
fun createAccountOnboardingView(
internal fun createAccountOnboardingView(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 API change


/**
* Controller for a full screen component.
*/
@PrivateBetaConnectSDK
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
interface StripeComponentController<Listener : StripeEmbeddedComponentListener> {
abstract class StripeComponentController<Listener, Props> internal constructor(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 As mentioned earlier, this was changed to an abstract class with an internal constructor. Its implementation was merged in from StripeComponentControllerImpl, which was deleted. There are no logic changes.

/**
* A full-screen DialogFragment that displays a full-screen component.
*
* The implementation to make this all work *well* is quite tricky and deserves some explanation.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 These implementation notes are from StripeComponentControllerImpl. I didn't put this in StripeComponentController due to previous feedback to reduce its visibility to users.

@lng-stripe lng-stripe marked this pull request as ready for review March 6, 2025 18:17
@lng-stripe lng-stripe requested review from a team as code owners March 6, 2025 18:17
@lng-stripe lng-stripe requested a review from amk-stripe March 6, 2025 20:49
Copy link
Collaborator

@amk-stripe amk-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please split this up into multiple PRs? This makes review so much easier and is also much better for commit and PR history

I'm thinking that since there are 4 bullet points of things that happened here, this should definitely be multiple PRs. And the API changes could at least be their own PR with a link to the updated API review so I can see some context on the changes.

Thank you!!

@lng-stripe
Copy link
Contributor Author

Can you please split this up into multiple PRs?

Will do, but I will flag that with recent CI flakiness this could potentially be really painful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants