Skip to content

Commit 3bf8c52

Browse files
authored
add an overload where you dont need to pass is isPrelaod (#409)
1 parent aba7e84 commit 3bf8c52

File tree

2 files changed

+8
-4
lines changed
  • lib/src/main/java/com/shopify/checkoutsheetkit
  • samples/MobileBuyIntegration/app/src/main/java/com/shopify/checkout_sdk_mobile_buy_integration_sample/checkout

2 files changed

+8
-4
lines changed

lib/src/main/java/com/shopify/checkoutsheetkit/CheckoutWebView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ public class CheckoutWebView(context: Context, attributeSet: AttributeSet? = nul
111111
checkoutBridge.setWebView(null)
112112
}
113113

114-
public fun loadCheckout(url: String, isPreload: Boolean, options: CheckoutOptions? = null) {
114+
public fun loadCheckout(url: String, options: CheckoutOptions? = null) {
115+
loadCheckout(url, false, options)
116+
}
117+
118+
internal fun loadCheckout(url: String, isPreload: Boolean, options: CheckoutOptions? = null) {
115119
log.d(LOG_TAG, "Loading checkout with url $url. IsPreload: $isPreload.")
116120
this.isPreload = isPreload
117121
this.checkoutOptions = options

samples/MobileBuyIntegration/app/src/main/java/com/shopify/checkout_sdk_mobile_buy_integration_sample/checkout/CheckoutNavHost.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ fun CheckoutNavHost(
128128
val token = authService.fetchAccessToken()
129129
val options = CheckoutOptions(authToken = token)
130130
Timber.d("Loading checkout with authentication token")
131-
checkoutWebView.loadCheckout(checkoutUrl, isPreload = false, options = options)
131+
checkoutWebView.loadCheckout(checkoutUrl, options)
132132
} catch (e: Exception) {
133133
Timber.e("Failed to fetch checkout app authentication token, loading without authentication: $e")
134-
checkoutWebView.loadCheckout(checkoutUrl, isPreload = false)
134+
checkoutWebView.loadCheckout(checkoutUrl)
135135
}
136136
} else {
137137
Timber.d("Checkout app authentication not configured, loading without authentication")
138-
checkoutWebView.loadCheckout(checkoutUrl, isPreload = false)
138+
checkoutWebView.loadCheckout(checkoutUrl)
139139
}
140140
}
141141
}

0 commit comments

Comments
 (0)