From 1584726f76811ebfc2f90fe5e64a7409a7c94091 Mon Sep 17 00:00:00 2001 From: hyochan Date: Sun, 30 Dec 2018 17:27:30 +0900 Subject: [PATCH] Release 2.4.0-beta5. Attempt to fix #315. --- android/src/main/java/com/dooboolab/RNIap/RNIapModule.java | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java b/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java index 2c95e2948..34cddfcd4 100644 --- a/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java +++ b/android/src/main/java/com/dooboolab/RNIap/RNIapModule.java @@ -109,7 +109,7 @@ public RNIapModule(ReactApplicationContext reactContext) { } private void ensureConnection (final Promise promise, final Runnable callback) { - if (mBillingClient != null) { + if (clientReady) { callback.run(); return; } @@ -121,7 +121,7 @@ private void ensureConnection (final Promise promise, final Runnable callback) { final BillingClientStateListener billingClientStateListener = new BillingClientStateListener() { @Override public void onBillingSetupFinished(@BillingClient.BillingResponse int responseCode) { - if (responseCode == BillingClient.BillingResponse.OK && !clientReady) { + if (responseCode == BillingClient.BillingResponse.OK ) { Log.d(TAG, "billing client ready"); callback.run(); clientReady = true; @@ -141,6 +141,7 @@ public void onBillingServiceDisconnected() { reactContext.bindService(intent, mServiceConn, Context.BIND_AUTO_CREATE); mBillingClient = BillingClient.newBuilder(reactContext).setListener(purchasesUpdatedListener).build(); mBillingClient.startConnection(billingClientStateListener); + clientReady = true; } catch (Exception e) { promise.reject(E_NOT_PREPARED, e.getMessage(), e); } diff --git a/package.json b/package.json index 935184a9f..7ad545679 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-iap", - "version": "2.4.0-beta4", + "version": "2.4.0-beta5", "description": "React Native In App Purchase Module.", "main": "index.js", "types": "index.d.ts",