[Android] 4.0.0-alpha.5
Pre-releaseBreaking changes
Preload failure state includes a diagnostic message
PreloadState.Failed now carries a best-effort diagnostic message alongside the failure reason. This changes its generated constructor, component functions, and copy method. Code that constructs or destructures Failed positionally must account for the new property:
preload?.listener = PreloadStateListener { state ->
if (state is PreloadState.Failed) {
- discardPreload(state.reason)
+ discardPreload(state.reason, state.message)
}
}The message is diagnostic context only. It is not a stable, machine-readable value; use FailureReason to determine how to handle the failure.
Preload failure reasons consolidated
PreloadState.FailureReason replaces WebContentProcessTerminated with WebContentUnavailable. Exhaustive when expressions must be updated:
when (val reason = state.reason) {
is PreloadState.FailureReason.HttpError ->
recordHttpFailure(reason.statusCode)
PreloadState.FailureReason.NavigationFailed ->
recordNavigationFailure()
- PreloadState.FailureReason.WebContentProcessTerminated ->
+ PreloadState.FailureReason.WebContentUnavailable ->
discardPreload()
PreloadState.FailureReason.ProtocolError ->
discardPreload()
}WebContentUnavailable indicates that cached web content became unavailable before the preload could be reused, including renderer termination.
Removed onMessageRejected from configuration
Configuration.onMessageRejected and the RejectedMessage type have been removed:
ShopifyCheckoutKit.configure {
it.allowedMessageOrigins = setOf(
"https://checkout.example.com",
"https://*.example.com",
)
- it.onMessageRejected = { rejection ->
- reportRejectedOrigin(rejection.origin, rejection.reason)
- }
}Messages dropped by origin validation are never silently discarded: the SDK logs each rejection as a warning with the verified origin and reason. The untrusted message body is not logged. allowedMessageOrigins is unchanged.
Additive changes
None.
Behaviour changes
External web links open in Custom Tabs
Links that leave the checkout WebView — including window.open requests — now open web URLs in Android Custom Tabs, so buyers stay in an in-app browser surface by default. Contact links (mailto:, tel:) and custom-scheme deep links still launch an external ACTION_VIEW intent, and web links fall back to the external browser when no Custom Tabs-capable browser is installed. Consumers can override window.open handling in their own protocol client.
Preload expiry fires proactively
A cached checkout WebView is now evicted automatically when its five-minute TTL elapses, transitioning the preload to Expired at that moment instead of only when the cache is next checked. Expiry is measured with elapsedRealtime(), so wall-clock adjustments do not affect it, and the TTL is reconciled when the app returns to the foreground after device sleep.
Displaced preload handles retain their last state
Calling preload again, or presenting a checkout that consumes the cached preload, stops the earlier CheckoutPreload handle from receiving updates. The handle now retains its last observed state instead of reflecting the shared cache, so it remains meaningful to inspect after displacement.
Origin-validation drops are logged as warnings
Rejected checkout messages were previously logged at debug level, invisible at the default LogLevel.WARN. They are now logged as warnings, so drops are visible without opting into debug logging.