@purchasely/cordova-plugin-purchasely 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSIONS.md CHANGED
@@ -16,4 +16,5 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
16
16
  | 1.2.0 | 2.8.0 | 2.8.0 |
17
17
  | 2.0.0 | 3.0.0 | 3.0.1 |
18
18
  | 2.0.1 | 3.0.0 | 3.0.1 |
19
- | 2.1.0 | 3.1.0 | 3.1.0 |
19
+ | 2.1.0 | 3.1.0 | 3.1.0 |
20
+ | 2.1.1 | 3.1.0 | 3.1.0 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Purchasely is a solution to ease the integration and boost your In-App Purchases & Subscriptions on the App Store, Google Play Store, Amazon Appstore and Huawei App Gallery.",
5
5
  "cordova": {
6
6
  "id": "@purchasely/cordova-plugin-purchasely",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="@purchasely/cordova-plugin-purchasely" version="2.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="@purchasely/cordova-plugin-purchasely" version="2.1.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>Purchasely</name>
4
4
  <js-module name="Purchasely" src="www/Purchasely.js">
5
5
  <clobbers target="Purchasely" />
@@ -73,9 +73,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
73
73
  switch (action) {
74
74
  case "startWithAPIKey":
75
75
  startWithAPIKey(
76
- args.getString(0),
76
+ getStringFromJson(args.getString(0)),
77
77
  args.getJSONArray(1),
78
- args.getString(2),
78
+ getStringFromJson(args.getString(2)),
79
79
  args.getInt(3),
80
80
  args.getInt(4),
81
81
  callbackContext);
@@ -93,19 +93,19 @@ public class PurchaselyPlugin extends CordovaPlugin {
93
93
  getAnonymousUserId(callbackContext);
94
94
  break;
95
95
  case "userLogin":
96
- userLogin(args.getString(0), callbackContext);
96
+ userLogin(getStringFromJson(args.getString(0)), callbackContext);
97
97
  break;
98
98
  case "userLogout":
99
99
  userLogout();
100
100
  break;
101
101
  case "setLanguage":
102
- setLanguage(args.getString(0));
102
+ setLanguage(getStringFromJson(args.getString(0)));
103
103
  break;
104
104
  case "setLogLevel":
105
105
  setLogLevel(args.getInt(0));
106
106
  break;
107
107
  case "setAttribute":
108
- setAttribute(args.getInt(0), args.getString(1));
108
+ setAttribute(args.getInt(0), getStringFromJson(args.getString(1)));
109
109
  break;
110
110
  case "setDefaultPresentationResultHandler":
111
111
  setDefaultPresentationResultHandler(callbackContext);
@@ -121,34 +121,34 @@ public class PurchaselyPlugin extends CordovaPlugin {
121
121
  break;
122
122
  case "presentPresentationWithIdentifier":
123
123
  presentPresentationWithIdentifier(
124
- args.getString(0),
125
- args.getString(1),
124
+ getStringFromJson(args.getString(0)),
125
+ getStringFromJson(args.getString(1)),
126
126
  args.getBoolean(2),
127
127
  callbackContext
128
128
  );
129
129
  break;
130
130
  case "presentPresentationForPlacement":
131
131
  presentPresentationForPlacement(
132
- args.getString(0),
133
- args.getString(1),
132
+ getStringFromJson(args.getString(0)),
133
+ getStringFromJson(args.getString(1)),
134
134
  args.getBoolean(2),
135
135
  callbackContext
136
136
  );
137
137
  break;
138
138
  case "presentProductWithIdentifier":
139
139
  presentProductWithIdentifier(
140
- args.getString(0),
141
- args.getString(1),
142
- args.getString(2),
140
+ getStringFromJson(args.getString(0)),
141
+ getStringFromJson(args.getString(1)),
142
+ getStringFromJson(args.getString(2)),
143
143
  args.getBoolean(3),
144
144
  callbackContext
145
145
  );
146
146
  break;
147
147
  case "presentPlanWithIdentifier":
148
148
  presentPlanWithIdentifier(
149
- args.getString(0),
150
- args.getString(1),
151
- args.getString(2),
149
+ getStringFromJson(args.getString(0)),
150
+ getStringFromJson(args.getString(1)),
151
+ getStringFromJson(args.getString(2)),
152
152
  args.getBoolean(3),
153
153
  callbackContext
154
154
  );
@@ -166,21 +166,21 @@ public class PurchaselyPlugin extends CordovaPlugin {
166
166
  userSubscriptions(callbackContext);
167
167
  break;
168
168
  case "handle":
169
- handle(args.getString(0), callbackContext);
169
+ handle(getStringFromJson(args.getString(0)), callbackContext);
170
170
  break;
171
171
  case "allProducts":
172
172
  allProducts(callbackContext);
173
173
  break;
174
174
  case "productWithIdentifier":
175
- productWithIdentifier(args.getString(0), callbackContext);
175
+ productWithIdentifier(getStringFromJson(args.getString(0)), callbackContext);
176
176
  break;
177
177
  case "planWithIdentifier":
178
- planWithIdentifier(args.getString(0), callbackContext);
178
+ planWithIdentifier(getStringFromJson(args.getString(0)), callbackContext);
179
179
  break;
180
180
  case "purchaseWithPlanVendorId":
181
181
  purchaseWithPlanVendorId(
182
- args.getString(0),
183
- args.getString(1),
182
+ getStringFromJson(args.getString(0)),
183
+ getStringFromJson(args.getString(1)),
184
184
  callbackContext
185
185
  );
186
186
  break;
@@ -203,6 +203,14 @@ public class PurchaselyPlugin extends CordovaPlugin {
203
203
  return true;
204
204
  }
205
205
 
206
+ private String getStringFromJson(String value) {
207
+ if(value == null || value.equals("null") || value.isEmpty()) {
208
+ return null;
209
+ }
210
+
211
+ return value;
212
+ }
213
+
206
214
  public static void sendPurchaseResult(PLYProductViewResult result, PLYPlan plan) {
207
215
  int productViewResult = 0;
208
216
  if(result == PLYProductViewResult.PURCHASED) {