Conversation
- Add AuthTabClient to CorePayments for managing auth tab flows - Update PayPalWebCheckoutClient to support ActivityResultLauncher - Add useAuthTabLauncher toggle in demo app for testing - Update browser switch clients to handle auth tab integration - Add androidx.browser:auth dependency for auth tab support
- Add AuthTabClientUnitTest to test auth tab launch scenarios - Extend BrowserSwitchClientUnitTest with activity launcher tests - Add PayPalWebLauncherUnitTest cases for activity launcher variant - Test auth tab launch with appLinkUrl and returnUrlScheme - Test error handling for auth tab launch failures - Verify correct token types and request codes
699b8c0 to
af9f06d
Compare
| public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/paypal/android/corepayments/Address;)Lcom/paypal/android/cardpayments/Card; | ||
| public static synthetic fun copy$default (Lcom/paypal/android/cardpayments/Card;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/paypal/android/corepayments/Address;ILjava/lang/Object;)Lcom/paypal/android/cardpayments/Card; | ||
| public fun describeContents ()I | ||
| public final fun describeContents ()I |
There was a problem hiding this comment.
In a strict sense, this is technically a breaking change. Is there a way to prevent this change?
CorePayments/src/main/java/com/paypal/android/corepayments/browserswitch/AuthTabClient.kt
Outdated
Show resolved
Hide resolved
| composeOptions { | ||
| // Ref: https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility | ||
| kotlinCompilerExtensionVersion "1.5.14" | ||
| kotlinCompilerExtensionVersion "1.5.15" |
There was a problem hiding this comment.
This is probably what caused the breaking changes.
There was a problem hiding this comment.
Not sure though actually, pure speculation.
There was a problem hiding this comment.
no I think this is because of kotlin version update, this is only for demo app, we don't do api check for demo app
| OnLifecycleOwnerResumeEffect { | ||
| val intent = context.getActivityOrNull()?.intent | ||
| intent?.let { viewModel.completeAuthChallenge(it) } | ||
| if (!uiState.useAuthTabLauncher) { |
There was a problem hiding this comment.
In a fallback scenario where AuthTab is unavailable and a CCT is launch, would useAuthTabLauncher == true prevent the deep link from being captured?
There was a problem hiding this comment.
fixed by adding check for it, good catch
| private fun Step2_StartPayPalCheckout(uiState: PayPalUiState, viewModel: PayPalCheckoutViewModel) { | ||
| val context = LocalContext.current | ||
|
|
||
| val activityResultLauncher = rememberLauncherForActivityResult( |
There was a problem hiding this comment.
This should probably be hoisted to the top level. The activity result launcher is only registered in Step2. In a cold start scenario, the deep link won't be captured.
| // do nothing; wait for user to authenticate PayPal checkout in Chrome Custom Tab | ||
| } | ||
| if (useAuthTabLauncher && activityResultLauncher != null) { | ||
| paypalClient.start(activity, checkoutRequest, activityResultLauncher) { startResult -> |
There was a problem hiding this comment.
I still feel like we don't need to pass the activity result launcher to PayPalClient. It would clean up the design a lot.
There was a problem hiding this comment.
Ya, we can definitely achieve it with composable module that's in draft PR, but need to check if we can avoid in non composable scenarios, will try to do on POC next
- provides Boolean isAuthTabSupported to check if device supports auth tab - handle fallback scenarios by using isAuthTabSupported in life cycle methods to avoid race conditions with activityLauncher
…ust checking for chrome browser
- apiDump - fix static analysis
Summary of changes
kotlin
fun start( activity: Activity, request: PayPalWebCheckoutRequest, activityResultLauncher: ActivityResultLauncher<Intent>, callback: PayPalWebStartCallback ) { }to pass activityResultLauncher parameter
Checklist
Authors