cordova-plugin-repro 6.22.0 → 6.24.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.
@@ -46,7 +46,376 @@ import io.repro.android.user.UserProfilePrefecture;
46
46
  */
47
47
  public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
48
48
 
49
- private static final String REPRO_CORDOVA_BRIDGE_VERSION = "6.22.0";
49
+ private static final String REPRO_CORDOVA_BRIDGE_VERSION = "6.24.0";
50
+
51
+ private interface CordovaReproCommand {
52
+ boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException;
53
+ }
54
+
55
+ private static final Map<String, CordovaReproCommand> COMMAND_MAP = new HashMap<>();
56
+
57
+ static {
58
+ COMMAND_MAP.put("setup", new CordovaReproCommand() {
59
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
60
+ return plugin.setup(args, callbackContext);
61
+ }
62
+ });
63
+ COMMAND_MAP.put("optIn", new CordovaReproCommand() {
64
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
65
+ return plugin.optIn(args, callbackContext);
66
+ }
67
+ });
68
+ COMMAND_MAP.put("setLogLevel", new CordovaReproCommand() {
69
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
70
+ return plugin.setLogLevel(args, callbackContext);
71
+ }
72
+ });
73
+ COMMAND_MAP.put("setUserID", new CordovaReproCommand() {
74
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
75
+ return plugin.setUserID(args, callbackContext);
76
+ }
77
+ });
78
+ COMMAND_MAP.put("setStringUserProfile", new CordovaReproCommand() {
79
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
80
+ return plugin.setStringUserProfile(args, callbackContext);
81
+ }
82
+ });
83
+ COMMAND_MAP.put("setIntUserProfile", new CordovaReproCommand() {
84
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
85
+ return plugin.setIntUserProfile(args, callbackContext);
86
+ }
87
+ });
88
+ COMMAND_MAP.put("setDoubleUserProfile", new CordovaReproCommand() {
89
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
90
+ return plugin.setDoubleUserProfile(args, callbackContext);
91
+ }
92
+ });
93
+ COMMAND_MAP.put("setDateUserProfile", new CordovaReproCommand() {
94
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
95
+ return plugin.setDateUserProfile(args, callbackContext);
96
+ }
97
+ });
98
+ COMMAND_MAP.put("setUserGender", new CordovaReproCommand() {
99
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
100
+ return plugin.setUserGender(args, callbackContext);
101
+ }
102
+ });
103
+ COMMAND_MAP.put("setUserEmailAddress", new CordovaReproCommand() {
104
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
105
+ return plugin.setUserEmailAddress(args, callbackContext);
106
+ }
107
+ });
108
+ COMMAND_MAP.put("setUserResidencePrefecture", new CordovaReproCommand() {
109
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
110
+ return plugin.setUserResidencePrefecture(args, callbackContext);
111
+ }
112
+ });
113
+ COMMAND_MAP.put("setUserDateOfBirth", new CordovaReproCommand() {
114
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
115
+ return plugin.setUserDateOfBirth(args, callbackContext);
116
+ }
117
+ });
118
+ COMMAND_MAP.put("setUserAge", new CordovaReproCommand() {
119
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
120
+ return plugin.setUserAge(args, callbackContext);
121
+ }
122
+ });
123
+ COMMAND_MAP.put("onlySetIfAbsentStringUserProfile", new CordovaReproCommand() {
124
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
125
+ return plugin.onlySetIfAbsentStringUserProfile(args, callbackContext);
126
+ }
127
+ });
128
+ COMMAND_MAP.put("onlySetIfAbsentIntUserProfile", new CordovaReproCommand() {
129
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
130
+ return plugin.onlySetIfAbsentIntUserProfile(args, callbackContext);
131
+ }
132
+ });
133
+ COMMAND_MAP.put("onlySetIfAbsentDoubleUserProfile", new CordovaReproCommand() {
134
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
135
+ return plugin.onlySetIfAbsentDoubleUserProfile(args, callbackContext);
136
+ }
137
+ });
138
+ COMMAND_MAP.put("onlySetIfAbsentDateUserProfile", new CordovaReproCommand() {
139
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
140
+ return plugin.onlySetIfAbsentDateUserProfile(args, callbackContext);
141
+ }
142
+ });
143
+ COMMAND_MAP.put("incrementIntUserProfileBy", new CordovaReproCommand() {
144
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
145
+ return plugin.incrementIntUserProfileBy(args, callbackContext);
146
+ }
147
+ });
148
+ COMMAND_MAP.put("decrementIntUserProfileBy", new CordovaReproCommand() {
149
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
150
+ return plugin.decrementIntUserProfileBy(args, callbackContext);
151
+ }
152
+ });
153
+ COMMAND_MAP.put("incrementDoubleUserProfileBy", new CordovaReproCommand() {
154
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
155
+ return plugin.incrementDoubleUserProfileBy(args, callbackContext);
156
+ }
157
+ });
158
+ COMMAND_MAP.put("decrementDoubleUserProfileBy", new CordovaReproCommand() {
159
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
160
+ return plugin.decrementDoubleUserProfileBy(args, callbackContext);
161
+ }
162
+ });
163
+ COMMAND_MAP.put("onlySetIfAbsentUserGender", new CordovaReproCommand() {
164
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
165
+ return plugin.onlySetIfAbsentUserGender(args, callbackContext);
166
+ }
167
+ });
168
+ COMMAND_MAP.put("onlySetIfAbsentUserEmailAddress", new CordovaReproCommand() {
169
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
170
+ return plugin.onlySetIfAbsentUserEmailAddress(args, callbackContext);
171
+ }
172
+ });
173
+ COMMAND_MAP.put("onlySetIfAbsentUserResidencePrefecture", new CordovaReproCommand() {
174
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
175
+ return plugin.onlySetIfAbsentUserResidencePrefecture(args, callbackContext);
176
+ }
177
+ });
178
+ COMMAND_MAP.put("onlySetIfAbsentUserDateOfBirth", new CordovaReproCommand() {
179
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
180
+ return plugin.onlySetIfAbsentUserDateOfBirth(args, callbackContext);
181
+ }
182
+ });
183
+ COMMAND_MAP.put("onlySetIfAbsentUserAge", new CordovaReproCommand() {
184
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
185
+ return plugin.onlySetIfAbsentUserAge(args, callbackContext);
186
+ }
187
+ });
188
+ COMMAND_MAP.put("incrementUserAgeBy", new CordovaReproCommand() {
189
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
190
+ return plugin.incrementUserAgeBy(args, callbackContext);
191
+ }
192
+ });
193
+ COMMAND_MAP.put("decrementUserAgeBy", new CordovaReproCommand() {
194
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
195
+ return plugin.decrementUserAgeBy(args, callbackContext);
196
+ }
197
+ });
198
+ COMMAND_MAP.put("deleteUserProfile", new CordovaReproCommand() {
199
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
200
+ return plugin.deleteUserProfile(args, callbackContext);
201
+ }
202
+ });
203
+ COMMAND_MAP.put("deleteUserGender", new CordovaReproCommand() {
204
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
205
+ return plugin.deleteUserGender(args, callbackContext);
206
+ }
207
+ });
208
+ COMMAND_MAP.put("deleteUserEmailAddress", new CordovaReproCommand() {
209
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
210
+ return plugin.deleteUserEmailAddress(args, callbackContext);
211
+ }
212
+ });
213
+ COMMAND_MAP.put("deleteUserResidencePrefecture", new CordovaReproCommand() {
214
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
215
+ return plugin.deleteUserResidencePrefecture(args, callbackContext);
216
+ }
217
+ });
218
+ COMMAND_MAP.put("deleteUserDateOfBirth", new CordovaReproCommand() {
219
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
220
+ return plugin.deleteUserDateOfBirth(args, callbackContext);
221
+ }
222
+ });
223
+ COMMAND_MAP.put("deleteUserAge", new CordovaReproCommand() {
224
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
225
+ return plugin.deleteUserAge(args, callbackContext);
226
+ }
227
+ });
228
+ COMMAND_MAP.put("track", new CordovaReproCommand() {
229
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
230
+ return plugin.track(args, callbackContext);
231
+ }
232
+ });
233
+ COMMAND_MAP.put("trackWithProperties", new CordovaReproCommand() {
234
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
235
+ return plugin.trackWithProperties(args, callbackContext);
236
+ }
237
+ });
238
+ COMMAND_MAP.put("trackViewContent", new CordovaReproCommand() {
239
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
240
+ return plugin.trackViewContent(args, callbackContext);
241
+ }
242
+ });
243
+ COMMAND_MAP.put("trackSearch", new CordovaReproCommand() {
244
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
245
+ return plugin.trackSearch(args, callbackContext);
246
+ }
247
+ });
248
+ COMMAND_MAP.put("trackAddToCart", new CordovaReproCommand() {
249
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
250
+ return plugin.trackAddToCart(args, callbackContext);
251
+ }
252
+ });
253
+ COMMAND_MAP.put("trackAddToWishlist", new CordovaReproCommand() {
254
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
255
+ return plugin.trackAddToWishlist(args, callbackContext);
256
+ }
257
+ });
258
+ COMMAND_MAP.put("trackInitiateCheckout", new CordovaReproCommand() {
259
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
260
+ return plugin.trackInitiateCheckout(args, callbackContext);
261
+ }
262
+ });
263
+ COMMAND_MAP.put("trackAddPaymentInfo", new CordovaReproCommand() {
264
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
265
+ return plugin.trackAddPaymentInfo(args, callbackContext);
266
+ }
267
+ });
268
+ COMMAND_MAP.put("trackPurchase", new CordovaReproCommand() {
269
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
270
+ return plugin.trackPurchase(args, callbackContext);
271
+ }
272
+ });
273
+ COMMAND_MAP.put("trackShare", new CordovaReproCommand() {
274
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
275
+ return plugin.trackShare(args, callbackContext);
276
+ }
277
+ });
278
+ COMMAND_MAP.put("trackLead", new CordovaReproCommand() {
279
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
280
+ return plugin.trackLead(args, callbackContext);
281
+ }
282
+ });
283
+ COMMAND_MAP.put("trackCompleteRegistration", new CordovaReproCommand() {
284
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
285
+ return plugin.trackCompleteRegistration(args, callbackContext);
286
+ }
287
+ });
288
+ COMMAND_MAP.put("enableInAppMessagesOnForegroundTransition", new CordovaReproCommand() {
289
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
290
+ return plugin.enableInAppMessagesOnForegroundTransition(args, callbackContext);
291
+ }
292
+ });
293
+ COMMAND_MAP.put("disableInAppMessagesOnForegroundTransition", new CordovaReproCommand() {
294
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
295
+ return plugin.disableInAppMessagesOnForegroundTransition(args, callbackContext);
296
+ }
297
+ });
298
+ COMMAND_MAP.put("enablePushNotification", new CordovaReproCommand() {
299
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
300
+ return plugin.enablePushNotification(args, callbackContext);
301
+ }
302
+ });
303
+ COMMAND_MAP.put("enablePushNotificationForIOS", new CordovaReproCommand() {
304
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
305
+ return true;
306
+ }
307
+ });
308
+ COMMAND_MAP.put("getUserID", new CordovaReproCommand() {
309
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
310
+ return plugin.getUserID(args, callbackContext);
311
+ }
312
+ });
313
+ COMMAND_MAP.put("getDeviceID", new CordovaReproCommand() {
314
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
315
+ return plugin.getDeviceID(args, callbackContext);
316
+ }
317
+ });
318
+ COMMAND_MAP.put("trackNotificationOpened", new CordovaReproCommand() {
319
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
320
+ return plugin.trackNotificationOpened(args, callbackContext);
321
+ }
322
+ });
323
+ COMMAND_MAP.put("setSilverEggCookie", new CordovaReproCommand() {
324
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
325
+ return plugin.setSilverEggCookie(args, callbackContext);
326
+ }
327
+ });
328
+ COMMAND_MAP.put("setSilverEggProdKey", new CordovaReproCommand() {
329
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
330
+ return plugin.setSilverEggProdKey(args, callbackContext);
331
+ }
332
+ });
333
+ COMMAND_MAP.put("linkLineID", new CordovaReproCommand() {
334
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
335
+ return plugin.linkLineID(args, callbackContext);
336
+ }
337
+ });
338
+ COMMAND_MAP.put("unlinkLineID", new CordovaReproCommand() {
339
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
340
+ return plugin.unlinkLineID(args, callbackContext);
341
+ }
342
+ });
343
+ COMMAND_MAP.put("getNewsFeedsWithLimit", new CordovaReproCommand() {
344
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
345
+ return plugin.getNewsFeedsWithLimit(args, callbackContext);
346
+ }
347
+ });
348
+ COMMAND_MAP.put("getNewsFeedsWithLimitAndOffsetId", new CordovaReproCommand() {
349
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
350
+ return plugin.getNewsFeedsWithLimitAndOffsetId(args, callbackContext);
351
+ }
352
+ });
353
+ COMMAND_MAP.put("getNewsFeedsWithLimitAndCampaignType", new CordovaReproCommand() {
354
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
355
+ return plugin.getNewsFeedsWithLimitAndCampaignType(args, callbackContext);
356
+ }
357
+ });
358
+ COMMAND_MAP.put("getNewsFeedsWithLimitAndOffsetIdAndCampaignType", new CordovaReproCommand() {
359
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
360
+ return plugin.getNewsFeedsWithLimitAndOffsetIdAndCampaignType(args, callbackContext);
361
+ }
362
+ });
363
+ COMMAND_MAP.put("updateNewsFeeds", new CordovaReproCommand() {
364
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
365
+ return plugin.updateNewsFeeds(args, callbackContext);
366
+ }
367
+ });
368
+ COMMAND_MAP.put("setOpenUrlCallback", new CordovaReproCommand() {
369
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
370
+ return plugin.setOpenUrlCallback(args, callbackContext);
371
+ }
372
+ });
373
+ COMMAND_MAP.put("remoteConfig_fetch", new CordovaReproCommand() {
374
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
375
+ return plugin.remoteConfig_fetch(args, callbackContext);
376
+ }
377
+ });
378
+ COMMAND_MAP.put("remoteConfig_activateFetched", new CordovaReproCommand() {
379
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
380
+ return plugin.remoteConfig_activateFetched(args, callbackContext);
381
+ }
382
+ });
383
+ COMMAND_MAP.put("remoteConfig_setDefaultsFromJson", new CordovaReproCommand() {
384
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
385
+ return plugin.remoteConfig_setDefaultsFromJson(args, callbackContext);
386
+ }
387
+ });
388
+ COMMAND_MAP.put("remoteConfig_setDefaultsFromJsonString", new CordovaReproCommand() {
389
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
390
+ return plugin.remoteConfig_setDefaultsFromJsonString(args, callbackContext);
391
+ }
392
+ });
393
+ COMMAND_MAP.put("remoteConfig_getAllValues", new CordovaReproCommand() {
394
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
395
+ return plugin.remoteConfig_getAllValues(args, callbackContext);
396
+ }
397
+ });
398
+ COMMAND_MAP.put("remoteConfig_getAllValuesWithPrefix", new CordovaReproCommand() {
399
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
400
+ return plugin.remoteConfig_getAllValuesWithPrefix(args, callbackContext);
401
+ }
402
+ });
403
+ COMMAND_MAP.put("remoteConfig_getValue", new CordovaReproCommand() {
404
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
405
+ return plugin.remoteConfig_getValue(args, callbackContext);
406
+ }
407
+ });
408
+ COMMAND_MAP.put("remoteConfig_getLocalDefaultValue", new CordovaReproCommand() {
409
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
410
+ return plugin.remoteConfig_getLocalDefaultValue(args, callbackContext);
411
+ }
412
+ });
413
+ COMMAND_MAP.put("remoteConfig_forceReset", new CordovaReproCommand() {
414
+ public boolean execute(CordovaPlugin plugin, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
415
+ return plugin.remoteConfig_forceReset(args, callbackContext);
416
+ }
417
+ });
418
+ }
50
419
 
51
420
  private static SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
52
421
 
@@ -58,155 +427,10 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
58
427
 
59
428
  @Override
60
429
  public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
61
- if ("setup".equals(action)) {
62
- return setup(args, callbackContext);
63
- }
64
- else if ("optIn".equals(action)) {
65
- return optIn(args, callbackContext);
66
- }
67
- else if ("setLogLevel".equals(action)) {
68
- return setLogLevel(args, callbackContext);
69
- }
70
- else if ("setUserID".equals(action)) {
71
- return setUserID(args, callbackContext);
72
- }
73
- else if ("setStringUserProfile".equals(action)) {
74
- return setStringUserProfile(args, callbackContext);
75
- }
76
- else if ("setIntUserProfile".equals(action)) {
77
- return setIntUserProfile(args, callbackContext);
78
- }
79
- else if ("setDoubleUserProfile".equals(action)) {
80
- return setDoubleUserProfile(args, callbackContext);
81
- }
82
- else if ("setDateUserProfile".equals(action)) {
83
- return setDateUserProfile(args, callbackContext);
84
- }
85
- else if ("setUserGender".equals(action)) {
86
- return setUserGender(args, callbackContext);
87
- }
88
- else if ("setUserEmailAddress".equals(action)) {
89
- return setUserEmailAddress(args, callbackContext);
90
- }
91
- else if ("setUserResidencePrefecture".equals(action)) {
92
- return setUserResidencePrefecture(args, callbackContext);
93
- }
94
- else if ("setUserDateOfBirth".equals(action)) {
95
- return setUserDateOfBirth(args, callbackContext);
96
- }
97
- else if ("setUserAge".equals(action)) {
98
- return setUserAge(args, callbackContext);
99
- }
100
- else if ("track".equals(action)) {
101
- return track(args, callbackContext);
102
- }
103
- else if ("trackWithProperties".equals(action)) {
104
- return trackWithProperties(args, callbackContext);
105
- }
106
- else if ("trackViewContent".equals(action)) {
107
- return trackViewContent(args, callbackContext);
108
- }
109
- else if ("trackSearch".equals(action)) {
110
- return trackSearch(args, callbackContext);
111
- }
112
- else if ("trackAddToCart".equals(action)) {
113
- return trackAddToCart(args, callbackContext);
114
- }
115
- else if ("trackAddToWishlist".equals(action)) {
116
- return trackAddToWishlist(args, callbackContext);
117
- }
118
- else if ("trackInitiateCheckout".equals(action)) {
119
- return trackInitiateCheckout(args, callbackContext);
120
- }
121
- else if ("trackAddPaymentInfo".equals(action)) {
122
- return trackAddPaymentInfo(args, callbackContext);
430
+ CordovaReproCommand command = COMMAND_MAP.get(action);
431
+ if (command != null) {
432
+ return command.execute(this, args, callbackContext);
123
433
  }
124
- else if ("trackPurchase".equals(action)) {
125
- return trackPurchase(args, callbackContext);
126
- }
127
- else if ("trackShare".equals(action)) {
128
- return trackShare(args, callbackContext);
129
- }
130
- else if ("trackLead".equals(action)) {
131
- return trackLead(args, callbackContext);
132
- }
133
- else if ("trackCompleteRegistration".equals(action)) {
134
- return trackCompleteRegistration(args, callbackContext);
135
- }
136
- else if ("enableInAppMessagesOnForegroundTransition".equals(action)) {
137
- return enableInAppMessagesOnForegroundTransition(args, callbackContext);
138
- }
139
- else if ("disableInAppMessagesOnForegroundTransition".equals(action)) {
140
- return disableInAppMessagesOnForegroundTransition(args, callbackContext);
141
- }
142
- else if ("enablePushNotification".equals(action)) {
143
- return enablePushNotification(args, callbackContext);
144
- }
145
- else if ("enablePushNotificationForIOS".equals(action)) {
146
- // do nothing
147
- return true;
148
- }
149
- else if ("getUserID".equals(action)) {
150
- return getUserID(args, callbackContext);
151
- }
152
- else if ("getDeviceID".equals(action)) {
153
- return getDeviceID(args, callbackContext);
154
- }
155
- else if ("trackNotificationOpened".equals(action)) {
156
- return trackNotificationOpened(args, callbackContext);
157
- }
158
- else if ("setSilverEggCookie".equals(action)) {
159
- return setSilverEggCookie(args, callbackContext);
160
- }
161
- else if ("setSilverEggProdKey".equals(action)) {
162
- return setSilverEggProdKey(args, callbackContext);
163
- }
164
- else if ("getNewsFeedsWithLimit".equals(action)) {
165
- return getNewsFeedsWithLimit(args, callbackContext);
166
- }
167
- else if ("getNewsFeedsWithLimitAndOffsetId".equals(action)) {
168
- return getNewsFeedsWithLimitAndOffsetId(args, callbackContext);
169
- }
170
- else if ("getNewsFeedsWithLimitAndCampaignType".equals(action)) {
171
- return getNewsFeedsWithLimitAndCampaignType(args, callbackContext);
172
- }
173
- else if ("getNewsFeedsWithLimitAndOffsetIdAndCampaignType".equals(action)) {
174
- return getNewsFeedsWithLimitAndOffsetIdAndCampaignType(args, callbackContext);
175
- }
176
- else if ("updateNewsFeeds".equals(action)) {
177
- return updateNewsFeeds(args, callbackContext);
178
- }
179
- else if ("setOpenUrlCallback".equals(action)) {
180
- return setOpenUrlCallback(args, callbackContext);
181
- }
182
- else if ("remoteConfig_fetch".equals(action)) {
183
- return remoteConfig_fetch(args, callbackContext);
184
- }
185
- else if ("remoteConfig_activateFetched".equals(action)) {
186
- return remoteConfig_activateFetched(args, callbackContext);
187
- }
188
- else if ("remoteConfig_setDefaultsFromJson".equals(action)) {
189
- return remoteConfig_setDefaultsFromJson(args, callbackContext);
190
- }
191
- else if ("remoteConfig_setDefaultsFromJsonString".equals(action)) {
192
- return remoteConfig_setDefaultsFromJsonString(args, callbackContext);
193
- }
194
- else if ("remoteConfig_getAllValues".equals(action)) {
195
- return remoteConfig_getAllValues(args, callbackContext);
196
- }
197
- else if ("remoteConfig_getAllValuesWithPrefix".equals(action)) {
198
- return remoteConfig_getAllValuesWithPrefix(args, callbackContext);
199
- }
200
- else if ("remoteConfig_getValue".equals(action)) {
201
- return remoteConfig_getValue(args, callbackContext);
202
- }
203
- else if ("remoteConfig_getLocalDefaultValue".equals(action)) {
204
- return remoteConfig_getLocalDefaultValue(args, callbackContext);
205
- }
206
- else if ("remoteConfig_forceReset".equals(action)) {
207
- return remoteConfig_forceReset(args, callbackContext);
208
- }
209
-
210
434
  return false;
211
435
  }
212
436
 
@@ -420,6 +644,279 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
420
644
  return true;
421
645
  }
422
646
 
647
+ private boolean onlySetIfAbsentStringUserProfile(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
648
+ final String key = args.getString(0);
649
+ final String value = args.getString(1);
650
+
651
+ callAPI(new API(callbackContext) {
652
+ Void api() {
653
+ Repro.onlySetIfAbsentStringUserProfile(key, value);
654
+ return null;
655
+ }
656
+ });
657
+
658
+ return true;
659
+ }
660
+
661
+ private boolean onlySetIfAbsentIntUserProfile(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
662
+ final String key = args.getString(0);
663
+ final int value = args.getInt(1);
664
+
665
+ callAPI(new API(callbackContext) {
666
+ Void api() {
667
+ Repro.onlySetIfAbsentIntUserProfile(key, value);
668
+ return null;
669
+ }
670
+ });
671
+
672
+ return true;
673
+ }
674
+
675
+ private boolean onlySetIfAbsentDoubleUserProfile(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
676
+ final String key = args.getString(0);
677
+ final double value = args.getDouble(1);
678
+
679
+ callAPI(new API(callbackContext) {
680
+ Void api() {
681
+ Repro.onlySetIfAbsentDoubleUserProfile(key, value);
682
+ return null;
683
+ }
684
+ });
685
+
686
+ return true;
687
+ }
688
+
689
+ private boolean onlySetIfAbsentDateUserProfile(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
690
+ final String key = args.getString(0);
691
+ final long timestamp = args.getLong(1);
692
+ final Date date = new Date(timestamp);
693
+
694
+ callAPI(new API(callbackContext) {
695
+ Void api() {
696
+ Repro.onlySetIfAbsentDateUserProfile(key, date);
697
+ return null;
698
+ }
699
+ });
700
+
701
+ return true;
702
+ }
703
+
704
+ private boolean incrementIntUserProfileBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
705
+ final String key = args.getString(0);
706
+ final int value = args.getInt(1);
707
+
708
+ callAPI(new API(callbackContext) {
709
+ Void api() {
710
+ Repro.incrementIntUserProfileBy(key, value);
711
+ return null;
712
+ }
713
+ });
714
+
715
+ return true;
716
+ }
717
+
718
+ private boolean decrementIntUserProfileBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
719
+ final String key = args.getString(0);
720
+ final int value = args.getInt(1);
721
+
722
+ callAPI(new API(callbackContext) {
723
+ Void api() {
724
+ Repro.decrementIntUserProfileBy(key, value);
725
+ return null;
726
+ }
727
+ });
728
+
729
+ return true;
730
+ }
731
+
732
+ private boolean incrementDoubleUserProfileBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
733
+ final String key = args.getString(0);
734
+ final double value = args.getDouble(1);
735
+
736
+ callAPI(new API(callbackContext) {
737
+ Void api() {
738
+ Repro.incrementDoubleUserProfileBy(key, value);
739
+ return null;
740
+ }
741
+ });
742
+
743
+ return true;
744
+ }
745
+
746
+ private boolean decrementDoubleUserProfileBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
747
+ final String key = args.getString(0);
748
+ final double value = args.getDouble(1);
749
+
750
+ callAPI(new API(callbackContext) {
751
+ Void api() {
752
+ Repro.decrementDoubleUserProfileBy(key, value);
753
+ return null;
754
+ }
755
+ });
756
+
757
+ return true;
758
+ }
759
+
760
+ private boolean onlySetIfAbsentUserGender(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
761
+ final int gender = args.getInt(0);
762
+
763
+ callAPI(new API(callbackContext) {
764
+ Void api() {
765
+ Repro.onlySetIfAbsentUserGender(UserProfileGender.values()[gender]);
766
+ return null;
767
+ }
768
+ });
769
+
770
+ return true;
771
+ }
772
+
773
+ private boolean onlySetIfAbsentUserEmailAddress(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
774
+ final String email = args.getString(0);
775
+
776
+ callAPI(new API(callbackContext) {
777
+ Void api() {
778
+ Repro.onlySetIfAbsentUserEmailAddress(email);
779
+ return null;
780
+ }
781
+ });
782
+
783
+ return true;
784
+ }
785
+
786
+ private boolean onlySetIfAbsentUserResidencePrefecture(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
787
+ final int prefecture = args.getInt(0);
788
+
789
+ callAPI(new API(callbackContext) {
790
+ Void api() {
791
+ Repro.onlySetIfAbsentUserResidencePrefecture(UserProfilePrefecture.values()[prefecture - 1]);
792
+ return null;
793
+ }
794
+ });
795
+
796
+ return true;
797
+ }
798
+
799
+ private boolean onlySetIfAbsentUserDateOfBirth(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
800
+ final long value = args.getLong(0);
801
+ final Date date = new Date(value);
802
+
803
+ callAPI(new API(callbackContext) {
804
+ Void api() {
805
+ Repro.onlySetIfAbsentUserDateOfBirth(date);
806
+ return null;
807
+ }
808
+ });
809
+
810
+ return true;
811
+ }
812
+
813
+ private boolean onlySetIfAbsentUserAge(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
814
+ final int age = args.getInt(0);
815
+
816
+ callAPI(new API(callbackContext) {
817
+ Void api() {
818
+ Repro.onlySetIfAbsentUserAge(age);
819
+ return null;
820
+ }
821
+ });
822
+
823
+ return true;
824
+ }
825
+
826
+ private boolean incrementUserAgeBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
827
+ final int value = args.getInt(0);
828
+
829
+ callAPI(new API(callbackContext) {
830
+ Void api() {
831
+ Repro.incrementUserAgeBy(value);
832
+ return null;
833
+ }
834
+ });
835
+
836
+ return true;
837
+ }
838
+
839
+ private boolean decrementUserAgeBy(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
840
+ final int value = args.getInt(0);
841
+
842
+ callAPI(new API(callbackContext) {
843
+ Void api() {
844
+ Repro.decrementUserAgeBy(value);
845
+ return null;
846
+ }
847
+ });
848
+
849
+ return true;
850
+ }
851
+
852
+ private boolean deleteUserProfile(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
853
+ final String key = args.getString(0);
854
+
855
+ callAPI(new API(callbackContext) {
856
+ Void api() {
857
+ Repro.deleteUserProfile(key);
858
+ return null;
859
+ }
860
+ });
861
+
862
+ return true;
863
+ }
864
+
865
+ private boolean deleteUserGender(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
866
+ callAPI(new API(callbackContext) {
867
+ Void api() {
868
+ Repro.deleteUserGender();
869
+ return null;
870
+ }
871
+ });
872
+
873
+ return true;
874
+ }
875
+
876
+ private boolean deleteUserEmailAddress(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
877
+ callAPI(new API(callbackContext) {
878
+ Void api() {
879
+ Repro.deleteUserEmailAddress();
880
+ return null;
881
+ }
882
+ });
883
+
884
+ return true;
885
+ }
886
+
887
+ private boolean deleteUserResidencePrefecture(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
888
+ callAPI(new API(callbackContext) {
889
+ Void api() {
890
+ Repro.deleteUserResidencePrefecture();
891
+ return null;
892
+ }
893
+ });
894
+
895
+ return true;
896
+ }
897
+
898
+ private boolean deleteUserDateOfBirth(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
899
+ callAPI(new API(callbackContext) {
900
+ Void api() {
901
+ Repro.deleteUserDateOfBirth();
902
+ return null;
903
+ }
904
+ });
905
+
906
+ return true;
907
+ }
908
+
909
+ private boolean deleteUserAge(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
910
+ callAPI(new API(callbackContext) {
911
+ Void api() {
912
+ Repro.deleteUserAge();
913
+ return null;
914
+ }
915
+ });
916
+
917
+ return true;
918
+ }
919
+
423
920
 
424
921
  private boolean track(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
425
922
  final String name = args.getString(0);
@@ -779,6 +1276,42 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
779
1276
  return true;
780
1277
  }
781
1278
 
1279
+ private boolean linkLineID(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
1280
+ final Object lineUserId = args.opt(0);
1281
+ final Object lineChannelId = args.opt(1);
1282
+ if (!(lineUserId instanceof String) || !(lineChannelId instanceof String)) {
1283
+ android.util.Log.e("Repro", "Didn't link LINE ID: LINE user ID and LINE channel ID are required, and should be String. null or undefined is not allowed.");
1284
+ return true;
1285
+ }
1286
+
1287
+ callAPI(new API(callbackContext) {
1288
+ Void api() {
1289
+ Repro.linkLineID((String)lineUserId, (String)lineChannelId);
1290
+ return null;
1291
+ }
1292
+ });
1293
+
1294
+ return true;
1295
+ }
1296
+
1297
+ private boolean unlinkLineID(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
1298
+ final Object lineUserId = args.opt(0);
1299
+ final Object lineChannelId = args.opt(1);
1300
+ if (!(lineUserId instanceof String) || !(lineChannelId instanceof String)) {
1301
+ android.util.Log.e("Repro", "Didn't unlink LINE ID: LINE user ID and LINE channel ID are required, and should be String. null or undefined is not allowed.");
1302
+ return true;
1303
+ }
1304
+
1305
+ callAPI(new API(callbackContext) {
1306
+ Void api() {
1307
+ Repro.unlinkLineID((String)lineUserId, (String)lineChannelId);
1308
+ return null;
1309
+ }
1310
+ });
1311
+
1312
+ return true;
1313
+ }
1314
+
782
1315
  private boolean getNewsFeedsWithLimit(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
783
1316
  final Object limit = args.opt(0);
784
1317
  if (!isValidNewsFeedRequestNumericParam(limit)) {