Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion platforms/android/lib/api/lib.api
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,6 @@ public final class com/shopify/checkoutkit/ShopifyCheckoutKit {
public static final fun configure (Lcom/shopify/checkoutkit/ConfigurationUpdater;)V
public static final fun getConfiguration ()Lcom/shopify/checkoutkit/Configuration;
public static final fun invalidate ()V
public static final fun preload (Ljava/lang/String;Landroidx/activity/ComponentActivity;)V
public static final fun present (Ljava/lang/String;Landroidx/activity/ComponentActivity;Lcom/shopify/checkoutkit/DefaultCheckoutEventProcessor;)Lcom/shopify/checkoutkit/CheckoutKitDialog;
public static final fun present (Ljava/lang/String;Landroidx/activity/ComponentActivity;Lcom/shopify/checkoutkit/DefaultCheckoutEventProcessor;Lcom/shopify/checkoutkit/CheckoutCommunicationClient;)Lcom/shopify/checkoutkit/CheckoutKitDialog;
public static synthetic fun present$default (Ljava/lang/String;Landroidx/activity/ComponentActivity;Lcom/shopify/checkoutkit/DefaultCheckoutEventProcessor;Lcom/shopify/checkoutkit/CheckoutCommunicationClient;ILjava/lang/Object;)Lcom/shopify/checkoutkit/CheckoutKitDialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ public object ShopifyCheckoutKit {
*
* @param checkoutUrl The URL of the checkout to be loaded, this can be obtained via the Storefront API
* @param context The context the checkout is being presented from
*
* Public preload support is coming soon.
*/
@JvmStatic
public fun preload(checkoutUrl: String, context: ComponentActivity) {
internal fun preload(checkoutUrl: String, context: ComponentActivity) {
log.d("ShopifyCheckoutKit", "Preload called. Preloading enabled ${configuration.preloading.enabled}.")
if (!configuration.preloading.enabled) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ class CartViewModel(
fun preloadCheckout(
activity: ComponentActivity,
) {
val state = _cartState.value
if (state is CartState.Cart) {
Timber.i("Preloading checkout with url ${state.checkoutUrl}")
ShopifyCheckoutKit.preload(state.checkoutUrl, activity)
} else {
Timber.i("Skipping checkout preload, cart is empty")
}
// val state = _cartState.value
// if (state is CartState.Cart) {
// Timber.i("Preloading checkout with url ${state.checkoutUrl}")
// ShopifyCheckoutKit.preload(state.checkoutUrl, activity)
// } else {
// Timber.i("Skipping checkout preload, cart is empty")
// }
}

fun continueShopping(navController: NavController) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class CartManager: ObservableObject {
init() {}

public func preloadCheckout() {
if let url = cart?.checkoutURL, isDirty {
ShopifyCheckoutKit.preload(checkout: url)
markCartAsReady()
}
// if let url = cart?.checkoutURL, isDirty {
// ShopifyCheckoutKit.preload(checkout: url)
// markCartAsReady()
// }
}

func markCartAsReady() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ struct CartLines: View {
CartManager.shared.cart = cart
updating = nil

if let checkoutUrl = cart.checkoutURL {
ShopifyCheckoutKit.preload(checkout: checkoutUrl)
}
// if let checkoutUrl = cart.checkoutURL {
// ShopifyCheckoutKit.preload(checkout: checkoutUrl)
// }
}
},
label: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,9 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData

tableView.reloadData()

if let url = CartManager.shared.cart?.checkoutURL {
ShopifyCheckoutKit.preload(checkout: url)
}
// if let url = CartManager.shared.cart?.checkoutURL {
// ShopifyCheckoutKit.preload(checkout: url)
// }
}

// MARK: UITableViewDataSource
Expand Down Expand Up @@ -375,9 +375,9 @@ class CartViewController: UIViewController, UITableViewDelegate, UITableViewData
self.setupCheckoutButtonContent()
cell.quantityLabel.text = "\(cart.lines.nodes[indexPath.item].quantity)"

if let checkoutUrl = cart.checkoutURL {
ShopifyCheckoutKit.preload(checkout: checkoutUrl)
}
// if let checkoutUrl = cart.checkoutURL {
// ShopifyCheckoutKit.preload(checkout: checkoutUrl)
// }
}
}
return cell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public func configure(_ block: (inout Configuration) -> Void) {
block(&configuration)
}

/// Preloads the checkout for faster presentation.
public func preload(checkout url: URL) {
/// Public preload support is coming soon.
internal func preload(checkout url: URL) {
guard configuration.preloading.enabled else {
return
}
Expand Down
Loading