Skip to content

Commit

Permalink
Release 2.4.0-beta2.
Browse files Browse the repository at this point in the history
Fixes for #315. Need more tests.
  • Loading branch information
hyochan committed Dec 26, 2018
1 parent 76a4043 commit 89ab809
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
12 changes: 6 additions & 6 deletions RNIapExample/android/app/build.gradle
Expand Up @@ -94,7 +94,7 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
Expand Down Expand Up @@ -137,11 +137,11 @@ android {
}

dependencies {
compile project(':react-native-gesture-handler')
compile project(':react-native-iap')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-gesture-handler')
implementation project(':react-native-iap')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.0.3"
implementation "com.facebook.react:react-native:+" // From node_modules

}

Expand Down
14 changes: 9 additions & 5 deletions android/src/main/java/com/dooboolab/RNIap/RNIapModule.java
Expand Up @@ -66,7 +66,9 @@ public class RNIapModule extends ReactContextBaseJavaModule {
private IInAppBillingService mService;
private BillingClient mBillingClient;

ServiceConnection mServiceConn = new ServiceConnection() {
private boolean clientReady = false;

private ServiceConnection mServiceConn = new ServiceConnection() {
@Override public void onServiceDisconnected(ComponentName name) {
mService = null;
}
Expand All @@ -76,7 +78,7 @@ public void onServiceConnected(ComponentName name, IBinder service) {
}
};

LifecycleEventListener lifecycleEventListener = new LifecycleEventListener() {
private LifecycleEventListener lifecycleEventListener = new LifecycleEventListener() {
@Override
public void onHostResume() {

Expand All @@ -100,7 +102,7 @@ public void onHostDestroy() {
}
};

public RNIapModule(ReactApplicationContext reactContext) {
private RNIapModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addLifecycleEventListener(lifecycleEventListener);
Expand All @@ -116,12 +118,13 @@ private void ensureConnection (final Promise promise, final Runnable callback) {
// This is the key line that fixed everything for me
intent.setPackage("com.android.vending");

BillingClientStateListener billingClientStateListener = new BillingClientStateListener() {
final BillingClientStateListener billingClientStateListener = new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(@BillingClient.BillingResponse int responseCode) {
if (responseCode == BillingClient.BillingResponse.OK) {
if (responseCode == BillingClient.BillingResponse.OK && !clientReady) {
Log.d(TAG, "billing client ready");
callback.run();
clientReady = true;
} else {
rejectPromiseWithBillingError(promise, responseCode);
}
Expand All @@ -130,6 +133,7 @@ public void onBillingSetupFinished(@BillingClient.BillingResponse int responseCo
@Override
public void onBillingServiceDisconnected() {
Log.d(TAG, "billing client disconnected");
clientReady = false;
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-iap",
"version": "2.4.0-betal",
"version": "2.4.0-beta2",
"description": "React Native In App Purchase Module.",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit 89ab809

Please sign in to comment.