Skip to content

Commit

Permalink
fix: fix typed array issue, update docs, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Oct 6, 2022
1 parent cda9f5a commit b1b955f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 5 additions & 5 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ IAP.addEventListener('purchaseUpdate', function (e) {
2. Use `queryPurchases` method every time the app is launched to know the status of any purchase made outside the app or in killed state. [Read more about this method here](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#querypurchases)

```js
const e = IAP.queryPurchases({productType: IAP.SKU_TYPE_INAPP});

// the response parameters are exactly same as in event listener `purchaseUpdate`
processQueriedPurchaseResponse(e);
const e = IAP.queryPurchases({
productType: IAP.SKU_TYPE_INAPP,
// the response parameters are exactly same as in event listener `purchaseUpdate`
callback: event => processQueriedPurchaseResponse(event)
});

function processQueriedPurchaseResponse(e) {
if (e.success) {
Expand All @@ -187,7 +188,6 @@ function processQueriedPurchaseResponse(e) {
}
```


### Acknowledge purchase
Once the purchase is made, it's mandatory to acknowledge it so Google Play can mark it as claimed. [Read more about acknowledging here](https://developer.android.com/google/play/billing/integrate#process)

Expand Down
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 3.0.0
version: 3.0.1
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: titanium-in-app-purchase
Expand Down
8 changes: 2 additions & 6 deletions android/src/ti/iap/TitaniumInAppPurchaseModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TitaniumInAppPurchaseModule : KrollModule() {
}

@Kroll.method
fun queryPurchases(args: KrollDict): KrollDict {
fun queryPurchases(args: KrollDict) {
val callback = args["callback"] as KrollFunction
val purchaseList = ArrayList<KrollDict>()
val resultDict = KrollDict()
Expand All @@ -229,17 +229,13 @@ class TitaniumInAppPurchaseModule : KrollModule() {
purchaseList.add(PurchaseModel(purchase).modelData)
}
}
event["purchaseList"] = purchaseList
event["purchaseList"] = purchaseList.toTypedArray()
event["code"] = billingResult.responseCode
event["success"] = billingResult.responseCode == OK
}
callback.callAsync(getKrollObject(), event)
}
}

resultDict[IAPConstants.Properties.PURCHASE_LIST] = purchaseList.toArray()

return resultDict
}

@Kroll.method
Expand Down

0 comments on commit b1b955f

Please sign in to comment.