Skip to content

Commit 53fac48

Browse files
Merge pull request #2 from qonversion/android_sdk_fix
Fixed rn-android bridge module
2 parents 298e96a + 8ab7106 commit 53fac48

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

android/src/main/java/com/reactlibrary/QonversionModule.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
import com.qonversion.android.sdk.QonversionBillingBuilder;
1010
import com.qonversion.android.sdk.QonversionCallback;
1111

12+
import com.android.billingclient.api.PurchasesUpdatedListener;
13+
import com.android.billingclient.api.BillingResult;
14+
import com.android.billingclient.api.BillingClient;
15+
import com.android.billingclient.api.Purchase;
16+
import java.util.List;
17+
import org.jetbrains.annotations.Nullable;
18+
import org.jetbrains.annotations.NotNull;
19+
1220
public class QonversionModule extends ReactContextBaseJavaModule {
1321

1422
private final ReactApplicationContext reactContext;
@@ -26,33 +34,33 @@ public String getName() {
2634
@ReactMethod
2735
public void launchWithKey(String key, Callback callback) {
2836
Qonversion.initialize(
29-
reactContext.mCurrentActivity.application,
37+
getCurrentActivity().getApplication(),
3038
key,
3139
"",
3240
buildBilling(),
3341
true,
34-
getCallback(callback),
42+
getCallback(callback)
3543
);
3644
}
3745

3846
@ReactMethod
3947
public void launchWithKeyUserID(String key, String userId) {
4048
Qonversion.initialize(
41-
reactContext.mCurrentActivity.application,
49+
getCurrentActivity().getApplication(),
4250
key,
4351
userId,
4452
buildBilling(),
4553
true,
46-
null,
54+
null
4755
);
4856
}
4957

5058
@ReactMethod
5159
public void launchWithKeyAutotrackPurchases(String key, boolean autoTrackPurchases, Callback callback) {
5260
Qonversion.initialize(
53-
reactContext.mCurrentActivity.application,
61+
getCurrentActivity().getApplication(),
5462
key,
55-
userId,
63+
"",
5664
buildBilling(),
5765
autoTrackPurchases,
5866
getCallback(callback)
@@ -69,7 +77,7 @@ public void onPurchasesUpdated(BillingResult billingResult, @Nullable List<Purch
6977
});
7078
}
7179

72-
private QonversionCallback getCallback(Callback callback) {
80+
private QonversionCallback getCallback(final Callback callback) {
7381
return new QonversionCallback() {
7482
@Override
7583
public void onSuccess(@NotNull String uid) {
@@ -78,7 +86,7 @@ public void onSuccess(@NotNull String uid) {
7886

7987
@Override
8088
public void onError(@NotNull Throwable t) {
81-
callback.invoke("Error launching Qonversion: " + t.localizedMessage + ", cause:" + t.cause);
89+
callback.invoke("Error launching Qonversion: " + t.getLocalizedMessage() + ", cause:" + t.getCause());
8290
}
8391
};
8492
}

package.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
{
22
"name": "react-native-qonversion",
33
"title": "React Native Qonversion",
4-
"version": "1.0.0",
5-
"description": "TODO",
4+
"version": "1.1.2",
5+
"description": "Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and content using our StoreKit wrapper and Google Play Billing wrapper.",
66
"main": "index.js",
77
"scripts": {
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"repository": {
1111
"type": "git",
12-
"url": "git+https://github.com/github_account/react-native-qonversion.git",
13-
"baseUrl": "https://github.com/github_account/react-native-qonversion"
12+
"url": "git+https://github.com/qonversion/react-native-sdk.git",
13+
"baseUrl": "https://github.com/qonversion/react-native-sdk"
1414
},
1515
"keywords": [
16-
"react-native"
16+
"react-native",
17+
"qonversion",
18+
"StoreKit",
19+
"SKStoreKit",
20+
"Google",
21+
"Play",
22+
"Billing",
23+
"in-app",
24+
"Purchases"
1725
],
1826
"author": {
19-
"name": "Your Name",
20-
"email": "yourname@email.com"
27+
"name": "Qonversion",
28+
"email": "hi@qonversion.io"
2129
},
2230
"license": "MIT",
2331
"licenseFilename": "LICENSE",

0 commit comments

Comments
 (0)