@purchasely/cordova-plugin-purchasely 1.2.0 → 1.2.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
@@ -14,3 +14,4 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
14
14
  | 1.1.7 | 2.7.3 | 2.7.4 |
15
15
  | 1.1.8 | 2.7.3 | 2.7.6 |
16
16
  | 1.2.0 | 2.8.0 | 2.8.0 |
17
+ | 1.2.1 | 2.8.0 | 2.8.0 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "1.2.0",
3
+ "version": "1.2.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="1.2.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="1.2.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" />
@@ -61,9 +61,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
61
61
  switch (action) {
62
62
  case "startWithAPIKey":
63
63
  startWithAPIKey(
64
- args.getString(0),
64
+ getStringFromJson(args.getString(0)),
65
65
  args.getJSONArray(1),
66
- args.getString(2),
66
+ getStringFromJson(args.getString(2)),
67
67
  args.getInt(3),
68
68
  args.getBoolean(4),
69
69
  callbackContext);
@@ -81,19 +81,19 @@ public class PurchaselyPlugin extends CordovaPlugin {
81
81
  getAnonymousUserId(callbackContext);
82
82
  break;
83
83
  case "userLogin":
84
- userLogin(args.getString(0), callbackContext);
84
+ userLogin(getStringFromJson(args.getString(0)), callbackContext);
85
85
  break;
86
86
  case "userLogout":
87
87
  userLogout();
88
88
  break;
89
89
  case "setLanguage":
90
- setLanguage(args.getString(0));
90
+ setLanguage(getStringFromJson(args.getString(0)));
91
91
  break;
92
92
  case "setLogLevel":
93
93
  setLogLevel(args.getInt(0));
94
94
  break;
95
95
  case "setAttribute":
96
- setAttribute(args.getInt(0), args.getString(1));
96
+ setAttribute(args.getInt(0), getStringFromJson(args.getString(1)));
97
97
  break;
98
98
  case "setDefaultPresentationResultHandler":
99
99
  setDefaultPresentationResultHandler(callbackContext);
@@ -109,24 +109,24 @@ public class PurchaselyPlugin extends CordovaPlugin {
109
109
  break;
110
110
  case "presentPresentationWithIdentifier":
111
111
  presentPresentationWithIdentifier(
112
- args.getString(0),
113
- args.getString(1),
112
+ getStringFromJson(args.getString(0)),
113
+ getStringFromJson(args.getString(1)),
114
114
  callbackContext
115
115
  );
116
116
  break;
117
117
  case "presentProductWithIdentifier":
118
118
  presentProductWithIdentifier(
119
- args.getString(0),
120
- args.getString(1),
121
- args.getString(2),
119
+ getStringFromJson(args.getString(0)),
120
+ getStringFromJson(args.getString(1)),
121
+ getStringFromJson(args.getString(2)),
122
122
  callbackContext
123
123
  );
124
124
  break;
125
125
  case "presentPlanWithIdentifier":
126
126
  presentPlanWithIdentifier(
127
- args.getString(0),
128
- args.getString(1),
129
- args.getString(2),
127
+ getStringFromJson(args.getString(0)),
128
+ getStringFromJson(args.getString(1)),
129
+ getStringFromJson(args.getString(2)),
130
130
  callbackContext
131
131
  );
132
132
  break;
@@ -143,21 +143,21 @@ public class PurchaselyPlugin extends CordovaPlugin {
143
143
  userSubscriptions(callbackContext);
144
144
  break;
145
145
  case "handle":
146
- handle(args.getString(0), callbackContext);
146
+ handle(getStringFromJson(args.getString(0)), callbackContext);
147
147
  break;
148
148
  case "allProducts":
149
149
  allProducts(callbackContext);
150
150
  break;
151
151
  case "productWithIdentifier":
152
- productWithIdentifier(args.getString(0), callbackContext);
152
+ productWithIdentifier(getStringFromJson(args.getString(0)), callbackContext);
153
153
  break;
154
154
  case "planWithIdentifier":
155
- planWithIdentifier(args.getString(0), callbackContext);
155
+ planWithIdentifier(getStringFromJson(args.getString(0)), callbackContext);
156
156
  break;
157
157
  case "purchaseWithPlanVendorId":
158
158
  purchaseWithPlanVendorId(
159
- args.getString(0),
160
- args.getString(1),
159
+ getStringFromJson(args.getString(0)),
160
+ getStringFromJson(args.getString(1)),
161
161
  callbackContext
162
162
  );
163
163
  break;
@@ -183,6 +183,14 @@ public class PurchaselyPlugin extends CordovaPlugin {
183
183
  return true;
184
184
  }
185
185
 
186
+ private String getStringFromJson(String value) {
187
+ if(value == null || value.equals("null") || value.isEmpty()) {
188
+ return null;
189
+ }
190
+
191
+ return value;
192
+ }
193
+
186
194
  public static void sendPurchaseResult(PLYProductViewResult result, PLYPlan plan) {
187
195
  int productViewResult = 0;
188
196
  if(result == PLYProductViewResult.PURCHASED) {