cordova-plugin-insider 1.2.0
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/.github/CODEOWNERS +8 -0
- package/.github/workflows/git-leak.yml +25 -0
- package/.github/workflows/insider-cordova-SDK_release.yml +61 -0
- package/.github/workflows/release_task_merger.yml +22 -0
- package/.github/workflows/release_version_setter.yml +43 -0
- package/README.md +104 -0
- package/hooks/FSUtils.js +28 -0
- package/hooks/after_plugin_install.js +81 -0
- package/hooks/before_plugin_uninstall.js +49 -0
- package/package.json +19 -0
- package/plugin.xml +91 -0
- package/release_version.sh +27 -0
- package/slack_notifier.sh +20 -0
- package/src/android/CDVUtils.java +120 -0
- package/src/android/Constants.java +41 -0
- package/src/android/InsiderPlugin.java +814 -0
- package/src/android/build-extras.gradle +38 -0
- package/src/android/res/values/dimens.xml +4 -0
- package/src/android/res/values-sw600dp/dimens.xml +3 -0
- package/src/android/res/values-sw720dp/dimens.xml +3 -0
- package/src/android/res/values-xhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxxhdpi/dimens.xml +4 -0
- package/src/ios/IDFAHelper.h +7 -0
- package/src/ios/IDFAHelper.m +19 -0
- package/src/ios/InsiderPlugin.h +58 -0
- package/src/ios/InsiderPlugin.m +758 -0
- package/types/CallbackType.d.ts +7 -0
- package/types/ContentOptimizerDataType.d.ts +4 -0
- package/types/Event.d.ts +9 -0
- package/types/Gender.d.ts +5 -0
- package/types/Identifier.d.ts +7 -0
- package/types/InsiderPlugin.d.ts +51 -0
- package/types/Product.d.ts +18 -0
- package/types/User.d.ts +27 -0
- package/www/CallbackType.js +7 -0
- package/www/Constants.js +86 -0
- package/www/ContentOptimizerDataType.js +4 -0
- package/www/Event.js +96 -0
- package/www/Gender.js +5 -0
- package/www/Identifier.js +66 -0
- package/www/InsiderPlugin.js +364 -0
- package/www/Product.js +211 -0
- package/www/User.js +303 -0
- package/www/Utils.js +18 -0
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
package com.useinsider.cordova;
|
|
2
|
+
|
|
3
|
+
import static com.useinsider.insider.InsiderCallbackType.INAPP_BUTTON_CLICK;
|
|
4
|
+
import static com.useinsider.insider.InsiderCallbackType.NOTIFICATION_OPEN;
|
|
5
|
+
import static com.useinsider.insider.InsiderCallbackType.TEMP_STORE_ADDED_TO_CART;
|
|
6
|
+
import static com.useinsider.insider.InsiderCallbackType.TEMP_STORE_CUSTOM_ACTION;
|
|
7
|
+
import static com.useinsider.insider.InsiderCallbackType.TEMP_STORE_PURCHASE;
|
|
8
|
+
|
|
9
|
+
import android.app.Application;
|
|
10
|
+
import android.content.pm.PackageManager;
|
|
11
|
+
import android.os.Bundle;
|
|
12
|
+
import android.os.Handler;
|
|
13
|
+
import android.os.Looper;
|
|
14
|
+
import android.util.Log;
|
|
15
|
+
|
|
16
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
17
|
+
import com.google.firebase.messaging.RemoteMessage;
|
|
18
|
+
import com.huawei.hms.push.HmsMessageService;
|
|
19
|
+
import com.useinsider.insider.ContentOptimizerDataType;
|
|
20
|
+
import com.useinsider.insider.Insider;
|
|
21
|
+
import com.useinsider.insider.InsiderCallback;
|
|
22
|
+
import com.useinsider.insider.InsiderCallbackType;
|
|
23
|
+
import com.useinsider.insider.InsiderIdentifiers;
|
|
24
|
+
import com.useinsider.insider.InsiderProduct;
|
|
25
|
+
import com.useinsider.insider.InsiderUser;
|
|
26
|
+
import com.useinsider.insider.MessageCenterData;
|
|
27
|
+
import com.useinsider.insider.RecommendationEngine;
|
|
28
|
+
import com.useinsider.insiderhybrid.InsiderHybrid;
|
|
29
|
+
import com.useinsider.insiderhybrid.InsiderHybridUtils;
|
|
30
|
+
import com.useinsider.insiderhybrid.constants.InsiderHybridMethods;
|
|
31
|
+
|
|
32
|
+
import org.apache.cordova.CallbackContext;
|
|
33
|
+
import org.apache.cordova.CordovaPlugin;
|
|
34
|
+
import org.apache.cordova.PluginResult;
|
|
35
|
+
import org.json.JSONArray;
|
|
36
|
+
import org.json.JSONException;
|
|
37
|
+
import org.json.JSONObject;
|
|
38
|
+
|
|
39
|
+
import java.lang.annotation.Annotation;
|
|
40
|
+
import java.lang.reflect.Field;
|
|
41
|
+
import java.lang.reflect.Type;
|
|
42
|
+
import java.util.ArrayList;
|
|
43
|
+
import java.util.Date;
|
|
44
|
+
import java.util.HashMap;
|
|
45
|
+
import java.util.LinkedHashMap;
|
|
46
|
+
import java.util.List;
|
|
47
|
+
import java.util.Map;
|
|
48
|
+
|
|
49
|
+
public class InsiderPlugin extends CordovaPlugin {
|
|
50
|
+
private boolean isCoreInitialized = false;
|
|
51
|
+
|
|
52
|
+
@Override
|
|
53
|
+
protected void pluginInitialize() {
|
|
54
|
+
super.initialize(cordova, webView);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public void init(final String partnerName, final String sdkVersion) {
|
|
58
|
+
try {
|
|
59
|
+
if (Insider.Instance.isSDKInitialized())
|
|
60
|
+
return;
|
|
61
|
+
|
|
62
|
+
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
63
|
+
@Override
|
|
64
|
+
public void run() {
|
|
65
|
+
InsiderHybrid.initWithActivity(cordova.getActivity(), partnerName);
|
|
66
|
+
|
|
67
|
+
Insider.Instance.setSDKType("cordova");
|
|
68
|
+
Insider.Instance.setHybridSDKVersion(sdkVersion);
|
|
69
|
+
Insider.Instance.resumeSessionHybridConfig(cordova.getActivity());
|
|
70
|
+
|
|
71
|
+
if (isCoreInitialized) {
|
|
72
|
+
Insider.Instance.resumeSessionHybridRequestConfig();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
isCoreInitialized = true;
|
|
76
|
+
|
|
77
|
+
Insider.Instance.registerInsiderCallback(new InsiderCallback() {
|
|
78
|
+
@Override
|
|
79
|
+
public void doAction(JSONObject jsonObject, InsiderCallbackType insiderCallbackType) {
|
|
80
|
+
try {
|
|
81
|
+
String json = "{'action':'" + insiderCallbackType + "','result':" + jsonObject.toString() + "}";
|
|
82
|
+
|
|
83
|
+
loadHandleUrl(json);
|
|
84
|
+
} catch (Exception e) {
|
|
85
|
+
Insider.Instance.putException(e);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
Insider.Instance.handleHybridIntent();
|
|
91
|
+
Insider.Instance.storePartnerName(partnerName);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
} catch (Exception e) {
|
|
95
|
+
Insider.Instance.putException(e);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public void loadHandleUrl(String json) {
|
|
100
|
+
webView.loadUrl("javascript:cordova.fireDocumentEvent('ins_notification_handle'," + json + ");");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@Override
|
|
104
|
+
public boolean execute(String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException {
|
|
105
|
+
if (args == null) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
if (action.equals("init")) {
|
|
111
|
+
init(args.getString(0), args.getString(1));
|
|
112
|
+
} else if (action.equals("initWithCustomEndpoint")) {
|
|
113
|
+
Insider.Instance.setCustomEndpoint(args.getString(3));
|
|
114
|
+
|
|
115
|
+
init(args.getString(0), args.getString(1));
|
|
116
|
+
} else if (action.equals("setGDPRConsent")) {
|
|
117
|
+
Insider.Instance.setGDPRConsent(Boolean.parseBoolean(args.getString(0)));
|
|
118
|
+
} else if (action.equals("enableIDFACollection")) {
|
|
119
|
+
Insider.Instance.enableIDFACollection(Boolean.parseBoolean(args.getString(0)));
|
|
120
|
+
} else if (action.equals("startTrackingGeofence")) {
|
|
121
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
122
|
+
@Override
|
|
123
|
+
public void run() {
|
|
124
|
+
Insider.Instance.startTrackingGeofence();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
} else if (action.equals("getContentStringWithName")) {
|
|
128
|
+
ContentOptimizerDataType stringVariableDataType = getDataType(args.getString(2));
|
|
129
|
+
|
|
130
|
+
String optimizedString = Insider.Instance.getContentStringWithName(args.getString(0), args.getString(1), stringVariableDataType);
|
|
131
|
+
|
|
132
|
+
if (optimizedString != null && optimizedString.length() > 0) {
|
|
133
|
+
callbackSuccess(callbackContext, optimizedString);
|
|
134
|
+
}
|
|
135
|
+
} else if (action.equals("getContentIntWithName")) {
|
|
136
|
+
ContentOptimizerDataType intVariableDataType = getDataType(args.getString(2));
|
|
137
|
+
|
|
138
|
+
int optimizedInteger = Insider.Instance.getContentIntWithName(args.getString(0), args.getInt(1), intVariableDataType);
|
|
139
|
+
|
|
140
|
+
callbackSuccess(callbackContext, optimizedInteger);
|
|
141
|
+
} else if (action.equals("getContentBoolWithName")) {
|
|
142
|
+
ContentOptimizerDataType boolVariableDataType = getDataType(args.getString(2));
|
|
143
|
+
|
|
144
|
+
boolean optimizedBoolean = Insider.Instance.getContentBoolWithName(args.getString(0), args.getBoolean(1), boolVariableDataType);
|
|
145
|
+
|
|
146
|
+
callbackSuccess(callbackContext, optimizedBoolean);
|
|
147
|
+
} else if (action.equals("removeInapp")) {
|
|
148
|
+
Insider.Instance.removeInapp(this.cordova.getActivity());
|
|
149
|
+
} else if (action.equals(InsiderHybridMethods.ITEM_PURCHASED)) {
|
|
150
|
+
if (args.get(0) == null || args.getString(1) == null || args.getString(2) == null)
|
|
151
|
+
return false;
|
|
152
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
153
|
+
@Override
|
|
154
|
+
public void run() {
|
|
155
|
+
Map<String, Object> mustMap = null;
|
|
156
|
+
Map<String, Object> optMap = null;
|
|
157
|
+
try {
|
|
158
|
+
mustMap = CDVUtils.convertJSONToMap(args.getString(1));
|
|
159
|
+
optMap = CDVUtils.convertJSONToMap(args.getString(2));
|
|
160
|
+
|
|
161
|
+
isProductValid(mustMap);
|
|
162
|
+
InsiderProduct product = createProduct(mustMap, optMap);
|
|
163
|
+
|
|
164
|
+
Insider.Instance.itemPurchased(String.valueOf(args.get(0)), product);
|
|
165
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
166
|
+
} catch (JSONException e) {
|
|
167
|
+
callbackFailure(callbackContext, e.toString());
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
} else if (action.equals(InsiderHybridMethods.ITEM_ADDED_TO_CART)) {
|
|
172
|
+
if (args.get(0) == null || args.getString(1) == null)
|
|
173
|
+
return false;
|
|
174
|
+
|
|
175
|
+
Map<String, Object> mustMap = CDVUtils.convertJSONToMap(args.getString(0));
|
|
176
|
+
Map<String, Object> optMap = CDVUtils.convertJSONToMap(args.getString(1));
|
|
177
|
+
|
|
178
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
179
|
+
@Override
|
|
180
|
+
public void run() {
|
|
181
|
+
InsiderProduct product = createProduct(mustMap, optMap);
|
|
182
|
+
Insider.Instance.itemAddedToCart(product);
|
|
183
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
} else if (action.equals(InsiderHybridMethods.ITEM_REMOVED_FROM_CART)) {
|
|
187
|
+
if (args.get(0) == null)
|
|
188
|
+
return false;
|
|
189
|
+
|
|
190
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
191
|
+
@Override
|
|
192
|
+
public void run() {
|
|
193
|
+
try {
|
|
194
|
+
Insider.Instance.itemRemovedFromCart(args.getString(0));
|
|
195
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
196
|
+
} catch (JSONException e) {
|
|
197
|
+
e.printStackTrace();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
} else if (action.equals(InsiderHybridMethods.CART_CLEARED)) {
|
|
202
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
203
|
+
@Override
|
|
204
|
+
public void run() {
|
|
205
|
+
Insider.Instance.cartCleared();
|
|
206
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
} else if (action.equals(InsiderHybridMethods.GET_MESSAGE_CENTER_DATA)) {
|
|
210
|
+
if (args.get(0) == null || args.get(1) == null || args.get(2) == null)
|
|
211
|
+
return false;
|
|
212
|
+
|
|
213
|
+
cordova.getThreadPool().execute(() -> {
|
|
214
|
+
try {
|
|
215
|
+
int limit =args.getInt(0);
|
|
216
|
+
String startDate = args.getString(1);
|
|
217
|
+
String endDate = args.getString(2);
|
|
218
|
+
|
|
219
|
+
InsiderHybrid.getMessageCenterData(limit,startDate,endDate, new MessageCenterData() {
|
|
220
|
+
@Override
|
|
221
|
+
public void loadMessageCenterData(JSONArray jsonArray) {
|
|
222
|
+
callbackSuccess(callbackContext, jsonArray.toString());
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
} catch (JSONException e) {
|
|
226
|
+
callbackFailure(callbackContext, e.toString());
|
|
227
|
+
Insider.Instance.putException(e);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
} else if (action.equals(InsiderHybridMethods.GET_SMART_RECOMMENDATION)) {
|
|
231
|
+
if (args.get(0) == null || args.get(1) == null || args.get(2) == null)
|
|
232
|
+
return false;
|
|
233
|
+
|
|
234
|
+
cordova.getThreadPool().execute(() -> {
|
|
235
|
+
try {
|
|
236
|
+
int rId = args.getInt(0);
|
|
237
|
+
String locale = args.getString(1);
|
|
238
|
+
String currency = args.getString(2);
|
|
239
|
+
Insider.Instance.getSmartRecommendation(rId,locale,currency, new RecommendationEngine.SmartRecommendation() {
|
|
240
|
+
@Override
|
|
241
|
+
public void loadRecommendationData(JSONObject jsonObject) {
|
|
242
|
+
callbackSuccess(callbackContext, jsonObject.toString());
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
} catch (JSONException e) {
|
|
246
|
+
Insider.Instance.putException(e);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
} else if (action.equals(InsiderHybridMethods.GET_SMART_RECOMMENDATION_WITH_PRODUCT)) {
|
|
250
|
+
if (args.get(0) == null || args.get(1) == null || args.get(2) == null || args.get(3) == null)
|
|
251
|
+
return false;
|
|
252
|
+
|
|
253
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
254
|
+
@Override
|
|
255
|
+
public void run() {
|
|
256
|
+
try {
|
|
257
|
+
Map<String, Object> mustMap = CDVUtils.convertJSONToMap(args.getString(0));
|
|
258
|
+
Map<String, Object> optMap = CDVUtils.convertJSONToMap(args.getString(1));
|
|
259
|
+
|
|
260
|
+
InsiderProduct product = createProduct(mustMap, optMap);
|
|
261
|
+
Insider.Instance.getSmartRecommendationWithProduct(product,
|
|
262
|
+
args.getInt(2),
|
|
263
|
+
args.getString(3),
|
|
264
|
+
new RecommendationEngine.SmartRecommendation() {
|
|
265
|
+
@Override
|
|
266
|
+
public void loadRecommendationData(JSONObject jsonObject) {
|
|
267
|
+
callbackSuccess(callbackContext, jsonObject.toString());
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
} catch (JSONException e) {
|
|
271
|
+
callbackFailure(callbackContext, "ERROR:" + e.toString());
|
|
272
|
+
e.printStackTrace();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
} else if (action.equals(InsiderHybridMethods.CLICK_SMART_RECOMMENDATION_PRODUCT)) {
|
|
277
|
+
if (args.get(0) == null || args.get(1) == null || args.get(2) == null)
|
|
278
|
+
return false;
|
|
279
|
+
|
|
280
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
281
|
+
@Override
|
|
282
|
+
public void run() {
|
|
283
|
+
try {
|
|
284
|
+
Map<String, Object> mustMap = CDVUtils.convertJSONToMap(args.getString(0));
|
|
285
|
+
Map<String, Object> optMap = CDVUtils.convertJSONToMap(args.getString(1));
|
|
286
|
+
InsiderProduct recommendationLogProduct = createProduct(mustMap, optMap);
|
|
287
|
+
Insider.Instance.clickSmartRecommendationProduct(args.getInt(2),recommendationLogProduct);
|
|
288
|
+
callbackSuccess(callbackContext, "{SUCCESS}");
|
|
289
|
+
} catch (JSONException e) {
|
|
290
|
+
callbackFailure(callbackContext, "ERROR:" + e.toString());
|
|
291
|
+
e.printStackTrace();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
} else if (action.equals(InsiderHybridMethods.TAG_EVENT)) {
|
|
296
|
+
if (args.get(0) == null)
|
|
297
|
+
return false;
|
|
298
|
+
|
|
299
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
300
|
+
@Override
|
|
301
|
+
public void run() {
|
|
302
|
+
try {
|
|
303
|
+
Map<String, Object> parameters = CDVUtils.convertJSONToMap(args.getString(1));
|
|
304
|
+
InsiderHybrid.tagEvent(args.getString(0), parameters);
|
|
305
|
+
|
|
306
|
+
callbackSuccess(callbackContext, "{SUCCESS}");
|
|
307
|
+
} catch (JSONException e) {
|
|
308
|
+
Insider.Instance.putException(e);
|
|
309
|
+
callbackFailure(callbackContext, "FAIL");
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
} else if (action.equals(InsiderHybridMethods.VISIT_HOME_PAGE)) {
|
|
315
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
316
|
+
@Override
|
|
317
|
+
public void run() {
|
|
318
|
+
Insider.Instance.visitHomePage();
|
|
319
|
+
|
|
320
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
} else if (action.equals(InsiderHybridMethods.VISIT_LISTING_PAGE)) {
|
|
324
|
+
if (args.get(0) == null)
|
|
325
|
+
return false;
|
|
326
|
+
|
|
327
|
+
String[] taxonomy = (CDVUtils.convertJSONToArrayList(args.get(0).toString())).toArray(new String[0]);
|
|
328
|
+
|
|
329
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
330
|
+
@Override
|
|
331
|
+
public void run() {
|
|
332
|
+
Insider.Instance.visitListingPage(taxonomy);
|
|
333
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
} else if (action.equals(InsiderHybridMethods.VISIT_PRODUCT_DETAIL_PAGE)) {
|
|
337
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
338
|
+
return false;
|
|
339
|
+
|
|
340
|
+
Map<String, Object> mustMap = CDVUtils.convertJSONToMap(args.getString(0));
|
|
341
|
+
Map<String, Object> optMap = CDVUtils.convertJSONToMap(args.getString(1));
|
|
342
|
+
|
|
343
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
344
|
+
@Override
|
|
345
|
+
public void run() {
|
|
346
|
+
InsiderProduct recommendationProduct = createProduct(mustMap, optMap);
|
|
347
|
+
Insider.Instance.visitProductDetailPage(recommendationProduct);
|
|
348
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
} else if (action.equals(InsiderHybridMethods.VISIT_CART_PAGE)) {
|
|
352
|
+
if (args.get(0) == null)
|
|
353
|
+
return false;
|
|
354
|
+
|
|
355
|
+
String json = args.getString(0);
|
|
356
|
+
ArrayList products = new ObjectMapper().readValue(json, ArrayList.class);
|
|
357
|
+
InsiderProduct[] ips = new InsiderProduct[products.size()];
|
|
358
|
+
|
|
359
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
360
|
+
@Override
|
|
361
|
+
public void run() {
|
|
362
|
+
for (int i = 0; i < products.size(); i++) {
|
|
363
|
+
HashMap mustMap = (HashMap)(((LinkedHashMap)products.get(i)).get("productMustMap"));
|
|
364
|
+
HashMap optMap = (HashMap)(((LinkedHashMap)products.get(i)).get("productOptMap"));
|
|
365
|
+
InsiderProduct product = createProduct(mustMap, optMap);
|
|
366
|
+
ips[i] = product;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
Insider.Instance.visitCartPage(ips);
|
|
370
|
+
callbackSuccess(callbackContext, "SUCCESS");
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
} else if (action.equals(InsiderHybridMethods.SET_GENDER)) {
|
|
374
|
+
if (args.get(0) == null)
|
|
375
|
+
return false;
|
|
376
|
+
|
|
377
|
+
InsiderHybrid.setGender((args.getInt(0)));
|
|
378
|
+
} else if (action.equals(InsiderHybridMethods.SET_BIRTHDAY)) {
|
|
379
|
+
if (args.get(0) == null)
|
|
380
|
+
return false;
|
|
381
|
+
|
|
382
|
+
InsiderHybrid.setBirthday(args.getString(0));
|
|
383
|
+
} else if (action.equals(InsiderHybridMethods.SET_NAME)) {
|
|
384
|
+
if (args.get(0) == null)
|
|
385
|
+
return false;
|
|
386
|
+
|
|
387
|
+
Insider.Instance.getCurrentUser().setName(args.getString(0));
|
|
388
|
+
} else if (action.equals(InsiderHybridMethods.SET_SURNAME)) {
|
|
389
|
+
if (args.get(0) == null)
|
|
390
|
+
return false;
|
|
391
|
+
|
|
392
|
+
Insider.Instance.getCurrentUser().setSurname(args.getString(0));
|
|
393
|
+
} else if (action.equals(InsiderHybridMethods.SET_AGE)) {
|
|
394
|
+
if (args.get(0) == null)
|
|
395
|
+
return false;
|
|
396
|
+
|
|
397
|
+
Insider.Instance.getCurrentUser().setAge(args.getInt(0));
|
|
398
|
+
} else if (action.equals(InsiderHybridMethods.SET_SMS_OPTIN)) {
|
|
399
|
+
if (args.get(0) == null)
|
|
400
|
+
return false;
|
|
401
|
+
|
|
402
|
+
Insider.Instance.getCurrentUser().setSMSOptin(args.getBoolean(0));
|
|
403
|
+
} else if (action.equals(InsiderHybridMethods.SET_EMAIL_OPTIN)) {
|
|
404
|
+
if (args.get(0) == null)
|
|
405
|
+
return false;
|
|
406
|
+
|
|
407
|
+
Insider.Instance.getCurrentUser().setEmailOptin(args.getBoolean(0));
|
|
408
|
+
} else if (action.equals(InsiderHybridMethods.SET_PUSH_OPTIN)) {
|
|
409
|
+
if (args.get(0) == null)
|
|
410
|
+
return false;
|
|
411
|
+
|
|
412
|
+
Insider.Instance.getCurrentUser().setPushOptin(args.getBoolean(0));
|
|
413
|
+
} else if (action.equals(InsiderHybridMethods.SET_LOCATION_OPTIN)) {
|
|
414
|
+
if (args.get(0) == null)
|
|
415
|
+
return false;
|
|
416
|
+
|
|
417
|
+
Insider.Instance.getCurrentUser().setLocationOptin(args.getBoolean(0));
|
|
418
|
+
} else if (action.equals(InsiderHybridMethods.SET_WHATSAPP_OPTIN)) {
|
|
419
|
+
if (args.get(0) == null)
|
|
420
|
+
return false;
|
|
421
|
+
|
|
422
|
+
Insider.Instance.getCurrentUser().setWhatsappOptin(args.getBoolean(0));
|
|
423
|
+
} else if (action.equals(InsiderHybridMethods.SET_LANGUAGE)) {
|
|
424
|
+
if (args.get(0) == null)
|
|
425
|
+
return false;
|
|
426
|
+
|
|
427
|
+
Insider.Instance.getCurrentUser().setLanguage(args.getString(0));
|
|
428
|
+
} else if (action.equals(InsiderHybridMethods.SET_LOCALE)) {
|
|
429
|
+
if (args.get(0) == null)
|
|
430
|
+
return false;
|
|
431
|
+
|
|
432
|
+
Insider.Instance.getCurrentUser().setLocale(args.getString(0));
|
|
433
|
+
} else if (action.equals(InsiderHybridMethods.SET_FACEBOOK_ID)) {
|
|
434
|
+
if (args.get(0) == null)
|
|
435
|
+
return false;
|
|
436
|
+
|
|
437
|
+
Insider.Instance.getCurrentUser().setFacebookID(args.getString(0));
|
|
438
|
+
} else if (action.equals(InsiderHybridMethods.SET_TWITTER_ID)) {
|
|
439
|
+
if (args.get(0) == null)
|
|
440
|
+
return false;
|
|
441
|
+
|
|
442
|
+
Insider.Instance.getCurrentUser().setTwitterID(args.getString(0));
|
|
443
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_STRING)) {
|
|
444
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
445
|
+
return false;
|
|
446
|
+
|
|
447
|
+
Insider.Instance.getCurrentUser().setCustomAttributeWithString(args.getString(0), args.getString(1));
|
|
448
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_DOUBLE)) {
|
|
449
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
450
|
+
return false;
|
|
451
|
+
|
|
452
|
+
Insider.Instance.getCurrentUser().setCustomAttributeWithDouble(args.getString(0), args.getDouble(1));
|
|
453
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_INT)) {
|
|
454
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
455
|
+
return false;
|
|
456
|
+
|
|
457
|
+
Insider.Instance.getCurrentUser().setCustomAttributeWithInt(args.getString(0), args.getInt(1));
|
|
458
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_BOOLEAN)) {
|
|
459
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
460
|
+
return false;
|
|
461
|
+
|
|
462
|
+
Insider.Instance.getCurrentUser().setCustomAttributeWithBoolean(args.getString(0), args.getBoolean(1));
|
|
463
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_DATE)) {
|
|
464
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
465
|
+
return false;
|
|
466
|
+
InsiderHybrid.setCustomAttributeWithDate(args.getString(0), args.getString(1));
|
|
467
|
+
} else if (action.equals(InsiderHybridMethods.SET_CUSTOM_ATTRIBUTE_WITH_ARRAY)) {
|
|
468
|
+
if (args.get(0) == null || args.get(1) == null)
|
|
469
|
+
return false;
|
|
470
|
+
|
|
471
|
+
ArrayList<String> arrayList = CDVUtils.convertJSONToArrayList(args.getString(1));
|
|
472
|
+
|
|
473
|
+
Insider.Instance.getCurrentUser().setCustomAttributeWithArray(args.getString(0), arrayList.toArray(new String[arrayList.size()]));
|
|
474
|
+
} else if (action.equals(InsiderHybridMethods.UNSET_CUSTOM_ATTRIBUTE)) {
|
|
475
|
+
if (args.get(0) == null)
|
|
476
|
+
return false;
|
|
477
|
+
Insider.Instance.getCurrentUser().unsetCustomAttribute(args.getString(0));
|
|
478
|
+
|
|
479
|
+
} else if (action.equals(InsiderHybridMethods.LOGIN)) {
|
|
480
|
+
if (args.get(0) == null) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
Map<String, Object> identifiers = CDVUtils.convertJSONToMap(args.getString(0));
|
|
485
|
+
|
|
486
|
+
InsiderIdentifiers insiderIdentifiers = new InsiderIdentifiers();
|
|
487
|
+
|
|
488
|
+
for (String key : identifiers.keySet()) {
|
|
489
|
+
switch (key) {
|
|
490
|
+
case InsiderHybridMethods.ADD_EMAIL:
|
|
491
|
+
insiderIdentifiers.addEmail(String.valueOf(identifiers.get(key)));
|
|
492
|
+
break;
|
|
493
|
+
case InsiderHybridMethods.ADD_PHONE_NUMBER:
|
|
494
|
+
insiderIdentifiers.addPhoneNumber(String.valueOf(identifiers.get(key)));
|
|
495
|
+
break;
|
|
496
|
+
case InsiderHybridMethods.ADD_USER_ID:
|
|
497
|
+
insiderIdentifiers.addUserID(String.valueOf(identifiers.get(key)));
|
|
498
|
+
break;
|
|
499
|
+
default:
|
|
500
|
+
insiderIdentifiers.addCustomIdentifier(key, String.valueOf(identifiers.get(key)));
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (args.length() > 1) {
|
|
506
|
+
Insider.Instance.getCurrentUser().login(insiderIdentifiers, new InsiderUser.InsiderIDResult() {
|
|
507
|
+
@Override
|
|
508
|
+
public void insiderIDResult(String insiderID) {
|
|
509
|
+
|
|
510
|
+
if (insiderID != null) {
|
|
511
|
+
callbackSuccess(callbackContext, insiderID);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
Insider.Instance.getCurrentUser().login(insiderIdentifiers);
|
|
519
|
+
} else if (action.equals(InsiderHybridMethods.LOGOUT)) {
|
|
520
|
+
Insider.Instance.getCurrentUser().logout();
|
|
521
|
+
} else if (action.equals(Constants.HANDLE_NOTIFICATION)) {
|
|
522
|
+
if (args.get(0) == null)
|
|
523
|
+
return false;
|
|
524
|
+
|
|
525
|
+
Map<String, String> remoteMessageStringMap = new HashMap<>();
|
|
526
|
+
remoteMessageStringMap = CDVUtils.convertJSONToStringMap(args.getString(0));
|
|
527
|
+
|
|
528
|
+
for (String key : remoteMessageStringMap.keySet()) {
|
|
529
|
+
remoteMessageStringMap.put(key, String.valueOf(CDVUtils.convertJSONToStringMap(args.getString(0)).get(key)));
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
String provider = Insider.Instance.getCurrentProvider(cordova.getContext());
|
|
533
|
+
|
|
534
|
+
switch (provider) {
|
|
535
|
+
case "huawei":
|
|
536
|
+
com.huawei.hms.push.RemoteMessage hmsRemoteMessage = new com.huawei.hms.push.RemoteMessage.Builder("insider").setData(remoteMessageStringMap).build();
|
|
537
|
+
Insider.Instance.handleHMSNotification(cordova.getContext(), hmsRemoteMessage);
|
|
538
|
+
break;
|
|
539
|
+
case "other":
|
|
540
|
+
case "google":
|
|
541
|
+
RemoteMessage fcmRemoteMessage = new RemoteMessage.Builder("insider").setData(remoteMessageStringMap).build();
|
|
542
|
+
Insider.Instance.handleFCMNotification(cordova.getContext(), fcmRemoteMessage);
|
|
543
|
+
break;
|
|
544
|
+
default:
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
} else if (action.equals("enableCarrierCollection")) {
|
|
548
|
+
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
549
|
+
@Override
|
|
550
|
+
public void run() {
|
|
551
|
+
try {
|
|
552
|
+
Insider.Instance.enableCarrierCollection(args.getBoolean(0));
|
|
553
|
+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
|
554
|
+
} catch (JSONException e) {
|
|
555
|
+
Insider.Instance.putException(e);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
} else if (action.equals("enableLocationCollection")) {
|
|
560
|
+
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
561
|
+
@Override
|
|
562
|
+
public void run() {
|
|
563
|
+
try {
|
|
564
|
+
Insider.Instance.enableLocationCollection(args.getBoolean(0));
|
|
565
|
+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
|
566
|
+
} catch (JSONException e) {
|
|
567
|
+
Insider.Instance.putException(e);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
} else if (action.equals("enableIpCollection")) {
|
|
572
|
+
cordova.getActivity().runOnUiThread(new Runnable() {
|
|
573
|
+
@Override
|
|
574
|
+
public void run() {
|
|
575
|
+
try {
|
|
576
|
+
Insider.Instance.enableIpCollection(args.getBoolean(0));
|
|
577
|
+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
|
|
578
|
+
} catch (JSONException e) {
|
|
579
|
+
Insider.Instance.putException(e);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
} else if (action.equals("getPluginInfo")) {
|
|
584
|
+
try {
|
|
585
|
+
PackageManager packageManager = this.cordova.getActivity().getPackageManager();
|
|
586
|
+
|
|
587
|
+
JSONObject r = new JSONObject();
|
|
588
|
+
|
|
589
|
+
r.put("version", packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName);
|
|
590
|
+
r.put("build", packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionCode);
|
|
591
|
+
|
|
592
|
+
callbackSuccess(callbackContext, r);
|
|
593
|
+
} catch (PackageManager.NameNotFoundException e) {
|
|
594
|
+
callbackContext.error("Exception thrown");
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
return true;
|
|
598
|
+
} else if (action.equals("putErrorLog")) {
|
|
599
|
+
if (args.get(0) == null)
|
|
600
|
+
return false;
|
|
601
|
+
|
|
602
|
+
Exception exceptionObject = new Exception(args.getString(0));
|
|
603
|
+
|
|
604
|
+
cordova.getThreadPool().execute(new Runnable() {
|
|
605
|
+
@Override
|
|
606
|
+
public void run() {
|
|
607
|
+
Insider.Instance.putException(exceptionObject);
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
} else if (action.equals(InsiderHybridMethods.REGISTER_WITH_QUIET_PERMISSION)) {
|
|
612
|
+
return true;
|
|
613
|
+
} else if (action.equals("signUpConfirmation")) {
|
|
614
|
+
Insider.Instance.signUpConfirmation();
|
|
615
|
+
} else {
|
|
616
|
+
return false;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return true;
|
|
620
|
+
} catch (Exception e) {
|
|
621
|
+
Insider.Instance.putException(e);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
private static ContentOptimizerDataType getDataType(String dataType) {
|
|
629
|
+
if (dataType.equals("Content")) {
|
|
630
|
+
return ContentOptimizerDataType.CONTENT;
|
|
631
|
+
} else {
|
|
632
|
+
return ContentOptimizerDataType.ELEMENT;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
private static void callbackSuccess(CallbackContext callbackContext, String callbackValue) {
|
|
637
|
+
try {
|
|
638
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, callbackValue);
|
|
639
|
+
|
|
640
|
+
pluginResult.setKeepCallback(true);
|
|
641
|
+
|
|
642
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
643
|
+
} catch (Exception e) {
|
|
644
|
+
Insider.Instance.putException(e);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
private static void callbackSuccess(CallbackContext callbackContext, JSONObject callbackValue) {
|
|
649
|
+
try {
|
|
650
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, callbackValue);
|
|
651
|
+
|
|
652
|
+
pluginResult.setKeepCallback(true);
|
|
653
|
+
|
|
654
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
655
|
+
} catch (Exception e) {
|
|
656
|
+
Insider.Instance.putException(e);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
private static void callbackSuccess(CallbackContext callbackContext, int callbackValue) {
|
|
661
|
+
try {
|
|
662
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, callbackValue);
|
|
663
|
+
|
|
664
|
+
pluginResult.setKeepCallback(true);
|
|
665
|
+
|
|
666
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
667
|
+
} catch (Exception e) {
|
|
668
|
+
Insider.Instance.putException(e);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
private static void callbackSuccess(CallbackContext callbackContext, boolean callbackValue) {
|
|
673
|
+
try {
|
|
674
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, callbackValue);
|
|
675
|
+
|
|
676
|
+
pluginResult.setKeepCallback(true);
|
|
677
|
+
|
|
678
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
679
|
+
} catch (Exception e) {
|
|
680
|
+
Insider.Instance.putException(e);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
private static void callbackFailure(CallbackContext callbackContext, String callbackValue) {
|
|
685
|
+
try {
|
|
686
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.ERROR, callbackValue);
|
|
687
|
+
|
|
688
|
+
pluginResult.setKeepCallback(true);
|
|
689
|
+
|
|
690
|
+
callbackContext.sendPluginResult(pluginResult);
|
|
691
|
+
} catch (Exception e) {
|
|
692
|
+
Insider.Instance.putException(e);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
private static boolean isProductValid(Map<String, Object> productMustMap) {
|
|
697
|
+
return productMustMap.containsKey(Constants.PRODUCT_ID)
|
|
698
|
+
&& productMustMap.containsKey(Constants.NAME)
|
|
699
|
+
&& productMustMap.containsKey(Constants.TAXONOMY)
|
|
700
|
+
&& productMustMap.containsKey(Constants.IMAGE_URL)
|
|
701
|
+
&& productMustMap.containsKey(Constants.UNIT_PRICE)
|
|
702
|
+
&& productMustMap.containsKey(Constants.CURRENCY);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
public static InsiderProduct createProduct(Map<String, Object> productMustMap, Map<String, Object> productOptMap) {
|
|
706
|
+
try {
|
|
707
|
+
if (!isProductValid(productMustMap)) return null;
|
|
708
|
+
|
|
709
|
+
String[] taxonomy;
|
|
710
|
+
|
|
711
|
+
Object taxObject = productMustMap.get(Constants.TAXONOMY);
|
|
712
|
+
|
|
713
|
+
if (taxObject.getClass().isArray()) {
|
|
714
|
+
taxonomy = (String[]) taxObject;
|
|
715
|
+
} else {
|
|
716
|
+
taxonomy = ((ArrayList<String>) taxObject).toArray(new String[0]);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
double price=0;
|
|
720
|
+
if(productMustMap.get(Constants.UNIT_PRICE) instanceof Integer ){
|
|
721
|
+
price = Integer.valueOf((Integer) productMustMap.get(Constants.UNIT_PRICE)).doubleValue();
|
|
722
|
+
}
|
|
723
|
+
else{
|
|
724
|
+
price = (double) productMustMap.get(Constants.UNIT_PRICE);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
InsiderProduct product = Insider.Instance.createNewProduct(
|
|
728
|
+
(String) productMustMap.get(Constants.PRODUCT_ID),
|
|
729
|
+
(String) productMustMap.get(Constants.NAME),
|
|
730
|
+
taxonomy,
|
|
731
|
+
(String) productMustMap.get(Constants.IMAGE_URL),
|
|
732
|
+
price,
|
|
733
|
+
(String) productMustMap.get(Constants.CURRENCY)
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
if (productOptMap == null || productOptMap.size() == 0) return product;
|
|
737
|
+
|
|
738
|
+
Map<String, Object> validatedMap = InsiderHybridUtils.validateMap(productOptMap);
|
|
739
|
+
|
|
740
|
+
for (Map.Entry<String, Object> entry : validatedMap.entrySet()) {
|
|
741
|
+
Object value = entry.getValue();
|
|
742
|
+
switch (entry.getKey()) {
|
|
743
|
+
case Constants.SALE_PRICE:
|
|
744
|
+
product.setSalePrice((double) value);
|
|
745
|
+
break;
|
|
746
|
+
case Constants.STOCK:
|
|
747
|
+
product.setStock(((int) value));
|
|
748
|
+
break;
|
|
749
|
+
case Constants.COLOR:
|
|
750
|
+
product.setColor((String) value);
|
|
751
|
+
break;
|
|
752
|
+
case Constants.SIZE:
|
|
753
|
+
product.setSize((String) value);
|
|
754
|
+
break;
|
|
755
|
+
case Constants.QUANTITY:
|
|
756
|
+
product.setQuantity(((int) value));
|
|
757
|
+
break;
|
|
758
|
+
case Constants.SHIPPING_COST:
|
|
759
|
+
product.setShippingCost((double) value);
|
|
760
|
+
break;
|
|
761
|
+
case Constants.VOUCHER_NAME:
|
|
762
|
+
product.setVoucherName((String) value);
|
|
763
|
+
break;
|
|
764
|
+
case Constants.VOUCHER_DISCOUNT:
|
|
765
|
+
product.setVoucherDiscount((double) value);
|
|
766
|
+
break;
|
|
767
|
+
case Constants.PROMOTION_NAME:
|
|
768
|
+
product.setPromotionName((String) value);
|
|
769
|
+
break;
|
|
770
|
+
case Constants.PROMOTION_DISCOUNT:
|
|
771
|
+
product.setPromotionDiscount((double) value);
|
|
772
|
+
break;
|
|
773
|
+
default:
|
|
774
|
+
setProductCustomAttribute(product, entry.getKey(), value);
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return product;
|
|
779
|
+
} catch (Exception e) {
|
|
780
|
+
Insider.Instance.putException(e);
|
|
781
|
+
}
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
private static void setProductCustomAttribute(InsiderProduct product, String key, Object value) {
|
|
786
|
+
try {
|
|
787
|
+
if (key == null || key.length() == 0 || value == null) return;
|
|
788
|
+
switch (value.getClass().getSimpleName()) {
|
|
789
|
+
case "String":
|
|
790
|
+
product.setCustomAttributeWithString(key, (String) value);
|
|
791
|
+
break;
|
|
792
|
+
case "Double":
|
|
793
|
+
product.setCustomAttributeWithDouble(key, (double) value);
|
|
794
|
+
break;
|
|
795
|
+
case "Integer":
|
|
796
|
+
product.setCustomAttributeWithInt(key, (int) value);
|
|
797
|
+
break;
|
|
798
|
+
case "Boolean":
|
|
799
|
+
product.setCustomAttributeWithBoolean(key, (boolean) value);
|
|
800
|
+
break;
|
|
801
|
+
case "Date":
|
|
802
|
+
product.setCustomAttributeWithDate(key, (Date) value);
|
|
803
|
+
break;
|
|
804
|
+
case "String[]":
|
|
805
|
+
product.setCustomAttributeWithArray(key, (String[]) value);
|
|
806
|
+
break;
|
|
807
|
+
default:
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
} catch (Exception e) {
|
|
811
|
+
Insider.Instance.putException(e);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|