From 8162af9344f959464ff256b22be38079ceef42bd Mon Sep 17 00:00:00 2001 From: Joshua Hutt Date: Thu, 18 Jul 2019 15:48:55 -0700 Subject: [PATCH] Keep valid SKUs in memory Don't drop previously retrieved SKUs when calling `getItemsByType` a second time. --- android/src/main/java/com/dooboolab/RNIap/RNIapModule.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java b/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java index e908c0085..7bbbbb503 100644 --- a/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java +++ b/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java @@ -76,6 +76,7 @@ public void onHostDestroy() { public RNIapModule(ReactApplicationContext reactContext) { super(reactContext); this.reactContext = reactContext; + this.skus = new ArrayList(); reactContext.addLifecycleEventListener(lifecycleEventListener); } @@ -234,7 +235,11 @@ public void onSkuDetailsResponse(BillingResult billingResult, List s return; } - skus = skuDetailsList; + for (SkuDetails sku : skuDetailsList) { + if (!skus.contains(sku)) { + skus.add(sku); + } + } WritableNativeArray items = new WritableNativeArray(); for (SkuDetails skuDetails : skuDetailsList) {