Skip to content

Commit

Permalink
Removed unused property and updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-amutha committed May 11, 2023
1 parent e09274e commit 8f930f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ The `restorePurchases()` function helps to recover your app user's previous purc
To retrieve **inactive** purchases along with the **active** purchases for your app user, you can call the `restorePurchases()` function with the `includeInActiveProducts` parameter set to `true`. If you only want to restore active subscriptions, set the parameter to `false`. Here is an example of how to use the `restorePurchases()` function in your code with the `includeInActiveProducts` parameter set to `true`.
```kotlin
CBPurchase.restorePurchases(context = this, includeInActivePurchases = false, object : CBCallback.RestorePurchaseCallback{
CBPurchase.restorePurchases(context = current activity context, includeInActivePurchases = false, object : CBCallback.RestorePurchaseCallback{
override fun onSuccess(result: List<CBRestoreSubscription>) {
result.forEach {
Log.i(javaClass.simpleName, "Successfully restored purchases")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ class BillingClientManager(context: Context) : PurchasesUpdatedListener {
private var billingClient: BillingClient? = null
var mContext: Context? = context
private val handler = Handler(Looper.getMainLooper())
private var skuType: String? = null
private var skuList = arrayListOf<String>()
private lateinit var callBack: CBCallback.ListProductsCallback<ArrayList<CBProduct>>
private var purchaseCallBack: CBCallback.PurchaseCallback<String>? = null
private val skusWithSkuDetails = arrayListOf<CBProduct>()
private val TAG = javaClass.simpleName
lateinit var product: CBProduct
private lateinit var completionCallback: CBCallback.RestorePurchaseCallback
private lateinit var restorePurchaseCallBack: CBCallback.RestorePurchaseCallback

init {
this.mContext = context
Expand Down Expand Up @@ -154,7 +151,7 @@ class BillingClientManager(context: Context) : PurchasesUpdatedListener {
* @param [completionCallback] The listener will be called when restore purchase completes.
*/
internal fun restorePurchases(completionCallback: CBCallback.RestorePurchaseCallback) {
this.completionCallback = completionCallback
this.restorePurchaseCallBack = completionCallback
onConnected({ status ->
queryPurchaseHistoryFromStore(status)
}, { error ->
Expand Down Expand Up @@ -314,11 +311,11 @@ class BillingClientManager(context: Context) : PurchasesUpdatedListener {
storeTransactions.addAll(purchaseHistoryList)
CBRestorePurchaseManager.fetchStoreSubscriptionStatus(
storeTransactions,
completionCallback
restorePurchaseCallBack
)
}
} else {
completionCallback.onError(
restorePurchaseCallBack.onError(
connectionError
)
}
Expand Down Expand Up @@ -363,7 +360,7 @@ class BillingClientManager(context: Context) : PurchasesUpdatedListener {
}
purchaseTransactionList(purchaseHistoryList)
} else {
completionCallback.onError(throwCBException(billingResult))
restorePurchaseCallBack.onError(throwCBException(billingResult))
}
}
}
Expand Down

0 comments on commit 8f930f2

Please sign in to comment.