Skip to content

update error handle, ensure no cancel on failure, clear cache on preload #52

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

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

kiftio
Copy link
Contributor

@kiftio kiftio commented Jan 25, 2024

What are you trying to accomplish?

Adding clearCache() within handleError recently was incorrect (unreleased so far). The cache was already being cleared in the case where checkout was already presented.

Instead we just needed to clear the cache for preloads. This is now being done in CheckoutWebViewEventProcessor.

Additionally, as errors were calling through to cancel, we were firing both onCheckoutCancel and onCheckoutError callbacks. This has been updated to ensure just one is called.

Cancel

err.mp4

Error

cancel.mp4

Before you deploy

@kiftio kiftio marked this pull request as ready for review January 25, 2024 12:15
@kiftio kiftio requested a review from a team as a code owner January 25, 2024 12:15
@@ -34,7 +34,7 @@ import com.shopify.checkoutsheetkit.pixelevents.PixelEvent
internal class CheckoutWebViewEventProcessor(
private val eventProcessor: CheckoutEventProcessor,
private val toggleHeader: (Boolean) -> Unit = {},
private val closeCheckoutDialog: () -> Unit = {},
private val closeCheckoutDialogWithError: (CheckoutException) -> Unit = { CheckoutWebView.clearCache() },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a default function, that is called if onCheckoutViewFailedWithError() is invoked before the view is presented in the dialog

@@ -28,7 +28,7 @@ android {
applicationId "com.shopify.checkout_sdk_mobile_buy_integration_sample"
minSdk 23
targetSdk 34
versionCode 17
versionCode 20
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated - just updating to the next Google Play version

@kiftio kiftio merged commit 42c3b17 into main Jan 25, 2024
@kiftio kiftio deleted the dk/update-error-handling branch January 25, 2024 13:47
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