Skip to content

Commit

Permalink
Removes all other deprecated purchase() methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
JayShortway committed May 29, 2024
1 parent 9119bca commit bb44815
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,66 +221,6 @@ class Purchases internal constructor(
purchasesOrchestrator.purchase(purchaseParams, callback)
}

/**
* Purchases a [StoreProduct]. If purchasing a subscription, it will choose the default [SubscriptionOption].
*
* The default [SubscriptionOption] logic:
* - Filters out offers with "rc-ignore-offer" tag
* - Uses [SubscriptionOption] WITH longest free trial or cheapest first phase
* - Falls back to use base plan
*
* @param [activity] Current activity
* @param [storeProduct] The StoreProduct of the product you wish to purchase
* @param [callback] The PurchaseCallback that will be called when purchase completes.
*/
@Deprecated(
"Use purchase() and PurchaseParams.Builder instead",
ReplaceWith("purchase()"),
)
fun purchaseProduct(
activity: Activity,
storeProduct: StoreProduct,
callback: PurchaseCallback,
) {
purchasesOrchestrator.startPurchase(
activity,
storeProduct.purchasingData,
null,
null,
callback,
)
}

/**
* Purchase a [Package]. If purchasing a subscription, it will choose the default [SubscriptionOption].
*
* The default [SubscriptionOption] logic:
* - Filters out offers with "rc-ignore-offer" tag
* - Uses [SubscriptionOption] WITH longest free trial or cheapest first phase
* - Falls back to use base plan
*
* @param [activity] Current activity
* @param [packageToPurchase] The Package you wish to purchase
* @param [listener] The listener that will be called when purchase completes.
*/
@Deprecated(
"Use purchase() and PurchaseParams.Builder instead",
ReplaceWith("purchase()"),
)
fun purchasePackage(
activity: Activity,
packageToPurchase: Package,
listener: PurchaseCallback,
) {
purchasesOrchestrator.startPurchase(
activity,
packageToPurchase.product.purchasingData,
packageToPurchase.presentedOfferingContext,
null,
listener,
)
}

/**
* Restores purchases made with the current Play Store account for the current user.
* This method will post all purchases associated with the current Play Store account to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.revenuecat.purchases

import android.app.Activity
import com.revenuecat.purchases.interfaces.LogInCallback
import com.revenuecat.purchases.interfaces.ProductChangeCallback
import com.revenuecat.purchases.interfaces.SyncAttributesAndOfferingsCallback
import com.revenuecat.purchases.interfaces.SyncPurchasesCallback
import com.revenuecat.purchases.models.StoreProduct
import com.revenuecat.purchases.models.StoreTransaction
import com.revenuecat.purchases.models.SubscriptionOption

internal fun logInSuccessListener(
onSuccess: (customerInfo: CustomerInfo, created: Boolean) -> Unit?,
Expand Down Expand Up @@ -61,46 +59,6 @@ internal fun syncAttributesAndOfferingsListener(
}
}

/**
* Purchase product. If purchasing a subscription, it will choose the default [SubscriptionOption].
* @param [activity] Current activity
* @param [storeProduct] The storeProduct of the product you wish to purchase
* @param [onSuccess] Will be called after the purchase has completed
* @param [onError] Will be called if there was an error with the purchase
*/
@Deprecated(
"Use purchase() and PurchaseParams.Builder instead",
ReplaceWith("purchase()"),
)
fun Purchases.purchaseProductWith(
activity: Activity,
storeProduct: StoreProduct,
onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB,
onSuccess: (purchase: StoreTransaction, customerInfo: CustomerInfo) -> Unit,
) {
purchaseProduct(activity, storeProduct, purchaseCompletedCallback(onSuccess, onError))
}

/**
* Make a purchase. If purchasing a subscription, it will choose the default [SubscriptionOption].
* @param [activity] Current activity
* @param [packageToPurchase] The Package you wish to purchase
* @param [onSuccess] Will be called after the purchase has completed
* @param [onError] Will be called if there was an error with the purchase
*/
@Deprecated(
"Use purchaseWith and PurchaseParams.Builder instead",
ReplaceWith("purchaseWith()"),
)
fun Purchases.purchasePackageWith(
activity: Activity,
packageToPurchase: Package,
onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB,
onSuccess: (purchase: StoreTransaction, customerInfo: CustomerInfo) -> Unit,
) {
purchasePackage(activity, packageToPurchase, purchaseCompletedCallback(onSuccess, onError))
}

/**
* This function will change the current appUserID.
* Typically this would be used after a log out to identify a new user without calling configure
Expand Down

0 comments on commit bb44815

Please sign in to comment.