cordova-plugin-repro 6.6.0 → 6.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-repro",
3
- "version": "6.6.0",
3
+ "version": "6.7.0",
4
4
  "description": "Repro Cordova Plugin",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-repro",
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version='1.0' encoding='UTF-8'?>
2
2
 
3
- <plugin xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-repro" version="6.6.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
3
+ <plugin xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-repro" version="6.7.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
4
4
  <name>Repro</name>
5
5
  <description>Repro Cordova Plugin</description>
6
6
  <license>Commercial</license>
@@ -73,3 +73,4 @@
73
73
 
74
74
 
75
75
 
76
+
@@ -1,5 +1,5 @@
1
1
  {
2
- "ios-sdk": "5.7.1",
3
- "android-sdk": "5.5.1",
4
- "bridge": "6.6.0"
2
+ "ios-sdk": "5.8.0",
3
+ "android-sdk": "5.6.0",
4
+ "bridge": "6.7.0"
5
5
  }
@@ -7,6 +7,7 @@ import android.view.Display;
7
7
  import android.view.WindowManager;
8
8
 
9
9
  import java.text.SimpleDateFormat;
10
+ import java.util.EnumSet;
10
11
  import java.util.Date;
11
12
  import java.util.HashMap;
12
13
  import java.util.Iterator;
@@ -26,6 +27,7 @@ import org.json.JSONObject;
26
27
  import io.repro.android.Repro;
27
28
  import io.repro.android.CordovaBridge;
28
29
  import io.repro.android.newsfeed.NewsFeedEntry;
30
+ import io.repro.android.newsfeed.NewsFeedCampaignType;
29
31
 
30
32
  /**
31
33
  * Created by nekoe on 1/15/16.
@@ -137,6 +139,12 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
137
139
  else if ("getNewsFeedsWithLimitAndOffsetId".equals(action)) {
138
140
  return getNewsFeedsWithLimitAndOffsetId(args, callbackContext);
139
141
  }
142
+ else if ("getNewsFeedsWithLimitAndCampaignType".equals(action)) {
143
+ return getNewsFeedsWithLimitAndCampaignType(args, callbackContext);
144
+ }
145
+ else if ("getNewsFeedsWithLimitAndOffsetIdAndCampaignType".equals(action)) {
146
+ return getNewsFeedsWithLimitAndOffsetIdAndCampaignType(args, callbackContext);
147
+ }
140
148
  else if ("updateNewsFeeds".equals(action)) {
141
149
  return updateNewsFeeds(args, callbackContext);
142
150
  }
@@ -145,6 +153,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
145
153
  }
146
154
 
147
155
  // API implementation
156
+ // CordovaArgs: https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaArgs.java
148
157
 
149
158
  private boolean setup(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
150
159
  final String token = args.getString(0);
@@ -623,7 +632,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
623
632
 
624
633
  private boolean getNewsFeedsWithLimit(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
625
634
  final Object limit = args.opt(0);
626
- if (!isValidNewsFeedRequestParam(limit)) {
635
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
627
636
  android.util.Log.e("Repro", "Didn't get NewsFeed: limit should be Number and more than 0.");
628
637
  return true;
629
638
  }
@@ -649,13 +658,13 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
649
658
 
650
659
  private boolean getNewsFeedsWithLimitAndOffsetId(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
651
660
  final Object limit = args.opt(0);
652
- if (!isValidNewsFeedRequestParam(limit)) {
661
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
653
662
  android.util.Log.e("Repro", "Didn't get NewsFeed: limit should be Number and more than 0.");
654
663
  return true;
655
664
  }
656
665
 
657
666
  final Object offsetId = args.opt(1);
658
- if (!isValidNewsFeedRequestParam(offsetId)) {
667
+ if (!isValidNewsFeedRequestNumericParam(offsetId)) {
659
668
  android.util.Log.e("Repro", "Didn't get NewsFeed: offset id should be Number and more than 0.");
660
669
  return true;
661
670
  }
@@ -679,7 +688,85 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
679
688
  return true;
680
689
  }
681
690
 
682
- private boolean isValidNewsFeedRequestParam(Object param) {
691
+ private boolean getNewsFeedsWithLimitAndCampaignType(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
692
+ final Object limit = args.opt(0);
693
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
694
+ android.util.Log.e("Repro", "Cannot get NewsFeed: limit should be Number and more than 0.");
695
+ return true;
696
+ }
697
+
698
+ final NewsFeedCampaignType mappedCampaignType = mapToCampaignTypes(args.optString(1));
699
+ cordova.getThreadPool().execute(new Runnable() {
700
+ @Override
701
+ public void run() {
702
+ JSONArray arr = new JSONArray();
703
+ try {
704
+ List<NewsFeedEntry> newsFeedEntries = Repro.getNewsFeeds(((Number) limit).intValue(), mappedCampaignType);
705
+ for (NewsFeedEntry newsFeedEntry : newsFeedEntries) {
706
+ arr.put(newsFeedEntryToJSONObject(newsFeedEntry));
707
+ }
708
+ callbackContext.success(arr);
709
+ } catch (Exception e) {
710
+ callbackContext.error("Failed to get NewsFeeds: " + e.getMessage());
711
+ }
712
+ }
713
+ });
714
+
715
+ return true;
716
+ }
717
+
718
+ private boolean getNewsFeedsWithLimitAndOffsetIdAndCampaignType(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
719
+ final Object limit = args.opt(0);
720
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
721
+ android.util.Log.e("Repro", "Cannot get NewsFeed: limit should be Number and more than 0.");
722
+ return true;
723
+ }
724
+
725
+ final Object offsetId = args.opt(1);
726
+ if (!isValidNewsFeedRequestNumericParam(offsetId)) {
727
+ android.util.Log.e("Repro", "Cannot get NewsFeed: offset id should be Number and more than 0.");
728
+ return true;
729
+ }
730
+
731
+ final NewsFeedCampaignType mappedCampaignType = mapToCampaignTypes(args.optString(2));
732
+ cordova.getThreadPool().execute(new Runnable() {
733
+ @Override
734
+ public void run() {
735
+ JSONArray arr = new JSONArray();
736
+ try {
737
+ List<NewsFeedEntry> newsFeedEntries = Repro.getNewsFeeds(((Number) limit).intValue(), ((Number) offsetId).intValue(), mappedCampaignType);
738
+ for (NewsFeedEntry newsFeedEntry : newsFeedEntries) {
739
+ arr.put(newsFeedEntryToJSONObject(newsFeedEntry));
740
+ }
741
+ callbackContext.success(arr);
742
+ } catch (Exception e) {
743
+ callbackContext.error("Failed to get NewsFeeds: " + e.getMessage());
744
+ }
745
+ }
746
+ });
747
+
748
+ return true;
749
+ }
750
+
751
+ private NewsFeedCampaignType mapToCampaignTypes(final String campaignType) {
752
+ if (campaignType == null) {
753
+ return NewsFeedCampaignType.Unknown;
754
+ }
755
+
756
+ if (campaignType.equals(NewsFeedCampaignType.PushNotification.getValue())) {
757
+ return NewsFeedCampaignType.PushNotification;
758
+ } else if (campaignType.equals(NewsFeedCampaignType.InAppMessage.getValue())) {
759
+ return NewsFeedCampaignType.InAppMessage;
760
+ } else if (campaignType.equals(NewsFeedCampaignType.WebMessage.getValue())) {
761
+ return NewsFeedCampaignType.WebMessage;
762
+ } else if (campaignType.equals(NewsFeedCampaignType.All.getValue())) {
763
+ return NewsFeedCampaignType.All;
764
+ } else {
765
+ return NewsFeedCampaignType.Unknown;
766
+ }
767
+ }
768
+
769
+ private boolean isValidNewsFeedRequestNumericParam(Object param) {
683
770
  return param instanceof Number && ((Number) param).intValue() > 0;
684
771
  }
685
772
 
@@ -696,6 +783,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
696
783
  entryObject.put("link_url", linkUrl);
697
784
  entryObject.put("image_url", imageUrl);
698
785
  entryObject.put("delivered_at", sDateFormat.format(entry.deliveredAt));
786
+ entryObject.put("campaign_type", entry.campaignType.getValue());
699
787
  entryObject.put("shown", entry.shown);
700
788
  entryObject.put("read", entry.read);
701
789
 
Binary file
@@ -418,6 +418,104 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
418
418
  }];
419
419
  }
420
420
 
421
+ - (void)getNewsFeedsWithLimitAndCampaignType:(CDVInvokedUrlCommand*)command
422
+ {
423
+ NSNumber* limit = [command.arguments objectAtIndex:0];
424
+ if (![self isValidNewsFeedRequestParam:limit]) {
425
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: limit should be Number and more than 0.");
426
+ return;
427
+ }
428
+
429
+ NSString* rawCampaignType = [command.arguments objectAtIndex:1];
430
+ RPRCampaignType convertedCampaigntype = [self getNewsFeedCampaignType:rawCampaignType];
431
+
432
+ [self.commandDelegate runInBackground:^{
433
+ NSError *error = nil;
434
+ NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:[limit unsignedLongLongValue] campaignType:convertedCampaigntype error:&error];
435
+
436
+ if (error)
437
+ {
438
+ NSString *errString = [error localizedDescription];
439
+ NSString *errMessage = [NSString.alloc initWithFormat:@"Failed to get NewsFeeds: %@", errString];
440
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMessage];
441
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
442
+ return;
443
+ }
444
+
445
+ NSMutableArray<NSDictionary *> *arr = [NSMutableArray.alloc initWithCapacity:entries.count];
446
+ for (RPRNewsFeedEntry *entry in entries) {
447
+ [arr addObject:[self newsFeedEntryToDictionary:entry]];
448
+ }
449
+
450
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:arr];
451
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
452
+ }];
453
+ }
454
+
455
+ - (void)getNewsFeedsWithLimitAndOffsetIdAndCampaignType:(CDVInvokedUrlCommand*)command
456
+ {
457
+ NSNumber* limit = [command.arguments objectAtIndex:0];
458
+ if (![self isValidNewsFeedRequestParam:limit]) {
459
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: limit should be Number and more than 0.");
460
+ return;
461
+ }
462
+
463
+ NSNumber* offsetId = [command.arguments objectAtIndex:1];
464
+ if (![self isValidNewsFeedRequestParam:offsetId])
465
+ {
466
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: offset id should be Number and more than 0.");
467
+ return;
468
+ }
469
+
470
+ NSString* rawCampaignType = [command.arguments objectAtIndex:2];
471
+ RPRCampaignType convertedCampaigntype = [self getNewsFeedCampaignType:rawCampaignType];
472
+
473
+ [self.commandDelegate runInBackground:^{
474
+ NSError *error = nil;
475
+ NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:[limit unsignedLongLongValue] offsetID:[offsetId unsignedLongLongValue] campaignType:convertedCampaigntype error:&error];
476
+
477
+ if (error)
478
+ {
479
+ NSString *errString = [error localizedDescription];
480
+ NSString *errMessage = [NSString.alloc initWithFormat:@"Failed to get NewsFeeds: %@", errString];
481
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMessage];
482
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
483
+ return;
484
+ }
485
+
486
+ NSMutableArray<NSDictionary *> *arr = [NSMutableArray.alloc initWithCapacity:entries.count];
487
+ for (RPRNewsFeedEntry *entry in entries) {
488
+ [arr addObject:[self newsFeedEntryToDictionary:entry]];
489
+ }
490
+
491
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:arr];
492
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
493
+ }];
494
+ }
495
+
496
+ - (RPRCampaignType)getNewsFeedCampaignType:(nullable NSString *)rawCampaignType
497
+ {
498
+ if (![rawCampaignType isKindOfClass:NSString.class]) {
499
+ return RPRCampaignTypeUnknown;
500
+ }
501
+
502
+ if ([rawCampaignType isEqualToString:@"push_notification"]) {
503
+ return RPRCampaignTypePushNotification;
504
+ }
505
+ else if ([rawCampaignType isEqualToString:@"in_app_message"]) {
506
+ return RPRCampaignTypeInAppMessage;
507
+ }
508
+ else if ([rawCampaignType isEqualToString:@"web_message"]) {
509
+ return RPRCampaignTypeWebMessage;
510
+ }
511
+ else if ([rawCampaignType isEqualToString:@"all"]) {
512
+ return RPRCampaignTypeAll;
513
+ }
514
+ else {
515
+ return RPRCampaignTypeUnknown;
516
+ }
517
+ }
518
+
421
519
  - (NSDictionary*)newsFeedEntryToDictionary:(RPRNewsFeedEntry *)entry
422
520
  {
423
521
  NSDictionary *entryJson = @{
@@ -429,6 +527,7 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
429
527
  @"shown": @(entry.shown),
430
528
  @"read": @(entry.read),
431
529
  @"delivered_at": [[self dateFormatter] stringFromDate:entry.deliveredAt],
530
+ @"campaign_type": [self convertCampaignTypeToString:entry.campaignType],
432
531
  @"link_url": entry.linkUrl ? [entry.linkUrl absoluteString] : @"",
433
532
  @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @""
434
533
  };
@@ -486,4 +585,21 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
486
585
  }];
487
586
  }
488
587
 
588
+ - (NSString *)convertCampaignTypeToString:(RPRCampaignType)campaignType
589
+ {
590
+ switch (campaignType) {
591
+ case RPRCampaignTypePushNotification:
592
+ return @"push_notification";
593
+ case RPRCampaignTypeInAppMessage:
594
+ return @"in_app_message";
595
+ case RPRCampaignTypeWebMessage:
596
+ return @"web_message";
597
+ case RPRCampaignTypeAll:
598
+ return @"all";
599
+
600
+ default:
601
+ return @"unknown";
602
+ }
603
+ }
604
+
489
605
  @end
@@ -6,33 +6,33 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_armv7_armv7s</string>
9
+ <string>ios-arm64_i386_x86_64-simulator</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>Repro.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>armv7</string>
16
- <string>armv7s</string>
15
+ <string>i386</string>
16
+ <string>x86_64</string>
17
17
  </array>
18
18
  <key>SupportedPlatform</key>
19
19
  <string>ios</string>
20
+ <key>SupportedPlatformVariant</key>
21
+ <string>simulator</string>
20
22
  </dict>
21
23
  <dict>
22
24
  <key>LibraryIdentifier</key>
23
- <string>ios-arm64_i386_x86_64-simulator</string>
25
+ <string>ios-arm64_armv7_armv7s</string>
24
26
  <key>LibraryPath</key>
25
27
  <string>Repro.framework</string>
26
28
  <key>SupportedArchitectures</key>
27
29
  <array>
28
30
  <string>arm64</string>
29
- <string>i386</string>
30
- <string>x86_64</string>
31
+ <string>armv7</string>
32
+ <string>armv7s</string>
31
33
  </array>
32
34
  <key>SupportedPlatform</key>
33
35
  <string>ios</string>
34
- <key>SupportedPlatformVariant</key>
35
- <string>simulator</string>
36
36
  </dict>
37
37
  </array>
38
38
  <key>CFBundlePackageType</key>
@@ -6,6 +6,16 @@
6
6
 
7
7
  #import <Foundation/Foundation.h>
8
8
 
9
+
10
+ typedef NS_ENUM(NSUInteger, RPRCampaignType) {
11
+ RPRCampaignTypeUnknown NS_SWIFT_NAME(unknown) = 0,
12
+
13
+ RPRCampaignTypePushNotification NS_SWIFT_NAME(pushNotification) = (1 << 0),
14
+ RPRCampaignTypeInAppMessage NS_SWIFT_NAME(inAppMessage) = (1 << 1),
15
+ RPRCampaignTypeWebMessage NS_SWIFT_NAME(webMessage) = (1 << 2),
16
+ RPRCampaignTypeAll NS_SWIFT_NAME(all) = (1 << 3),
17
+ };
18
+
9
19
  NS_ASSUME_NONNULL_BEGIN
10
20
 
11
21
  @interface RPRNewsFeedEntry : NSObject
@@ -15,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
15
25
  @property (nonatomic, readonly) NSString *title;
16
26
  @property (nonatomic, readonly) NSString *summary;
17
27
  @property (nonatomic, readonly) NSString *body;
28
+ @property (nonatomic, readonly) RPRCampaignType campaignType;
18
29
  @property (nonatomic, readonly, nullable) NSURL *linkUrl;
19
30
  @property (nonatomic, readonly, nullable) NSURL *imageUrl;
20
31
  @property (nonatomic, readonly) NSDate *deliveredAt;
@@ -144,11 +144,22 @@ NS_SWIFT_NAME(set(silverEggProdKey:));
144
144
  error:(NSError * _Nullable * _Nullable)error
145
145
  NS_SWIFT_NAME(getNewsFeeds(_:));
146
146
 
147
+ + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
148
+ campaignType:(RPRCampaignType)campaignType
149
+ error:(NSError * _Nullable * _Nullable)error
150
+ NS_SWIFT_NAME(getNewsFeeds(_:campaignType:));
151
+
147
152
  + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
148
153
  offsetID:(uint64_t)offsetID
149
154
  error:(NSError * _Nullable * _Nullable)error
150
155
  NS_SWIFT_NAME(getNewsFeeds(_:offsetID:));
151
156
 
157
+ + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
158
+ offsetID:(uint64_t)offsetID
159
+ campaignType:(RPRCampaignType)campaignType
160
+ error:(NSError * _Nullable * _Nullable)error
161
+ NS_SWIFT_NAME(getNewsFeeds(_:offsetID:campaignType:));
162
+
152
163
  + (BOOL)updateNewsFeeds:(nonnull NSArray<RPRNewsFeedEntry *> *)newsFeeds error:(NSError * _Nullable * _Nullable)error
153
164
  NS_SWIFT_NAME(updateNewsFeeds(_:));
154
165
 
@@ -6,6 +6,16 @@
6
6
 
7
7
  #import <Foundation/Foundation.h>
8
8
 
9
+
10
+ typedef NS_ENUM(NSUInteger, RPRCampaignType) {
11
+ RPRCampaignTypeUnknown NS_SWIFT_NAME(unknown) = 0,
12
+
13
+ RPRCampaignTypePushNotification NS_SWIFT_NAME(pushNotification) = (1 << 0),
14
+ RPRCampaignTypeInAppMessage NS_SWIFT_NAME(inAppMessage) = (1 << 1),
15
+ RPRCampaignTypeWebMessage NS_SWIFT_NAME(webMessage) = (1 << 2),
16
+ RPRCampaignTypeAll NS_SWIFT_NAME(all) = (1 << 3),
17
+ };
18
+
9
19
  NS_ASSUME_NONNULL_BEGIN
10
20
 
11
21
  @interface RPRNewsFeedEntry : NSObject
@@ -15,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
15
25
  @property (nonatomic, readonly) NSString *title;
16
26
  @property (nonatomic, readonly) NSString *summary;
17
27
  @property (nonatomic, readonly) NSString *body;
28
+ @property (nonatomic, readonly) RPRCampaignType campaignType;
18
29
  @property (nonatomic, readonly, nullable) NSURL *linkUrl;
19
30
  @property (nonatomic, readonly, nullable) NSURL *imageUrl;
20
31
  @property (nonatomic, readonly) NSDate *deliveredAt;
@@ -144,11 +144,22 @@ NS_SWIFT_NAME(set(silverEggProdKey:));
144
144
  error:(NSError * _Nullable * _Nullable)error
145
145
  NS_SWIFT_NAME(getNewsFeeds(_:));
146
146
 
147
+ + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
148
+ campaignType:(RPRCampaignType)campaignType
149
+ error:(NSError * _Nullable * _Nullable)error
150
+ NS_SWIFT_NAME(getNewsFeeds(_:campaignType:));
151
+
147
152
  + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
148
153
  offsetID:(uint64_t)offsetID
149
154
  error:(NSError * _Nullable * _Nullable)error
150
155
  NS_SWIFT_NAME(getNewsFeeds(_:offsetID:));
151
156
 
157
+ + (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
158
+ offsetID:(uint64_t)offsetID
159
+ campaignType:(RPRCampaignType)campaignType
160
+ error:(NSError * _Nullable * _Nullable)error
161
+ NS_SWIFT_NAME(getNewsFeeds(_:offsetID:campaignType:));
162
+
152
163
  + (BOOL)updateNewsFeeds:(nonnull NSArray<RPRNewsFeedEntry *> *)newsFeeds error:(NSError * _Nullable * _Nullable)error
153
164
  NS_SWIFT_NAME(updateNewsFeeds(_:));
154
165
 
package/www/Repro.js CHANGED
@@ -1,141 +1,158 @@
1
1
  var exec = require('cordova/exec');
2
2
 
3
- function Repro(){};
3
+ function Repro() { };
4
4
 
5
- Repro.prototype.setup = function(key, successCallback, errorCallback) {
5
+ Repro.prototype.setup = function (key, successCallback, errorCallback) {
6
6
  exec(successCallback, errorCallback, "Repro", "setup", [key]);
7
7
  };
8
8
 
9
- Repro.prototype.optIn = function(endUserOptedIn, successCallback, errorCallback) {
9
+ Repro.prototype.optIn = function (endUserOptedIn, successCallback, errorCallback) {
10
10
  exec(successCallback, errorCallback, "Repro", "optIn", [endUserOptedIn]);
11
11
  };
12
12
 
13
- Repro.prototype.setLogLevel = function(logLevel, successCallback, errorCallback) {
13
+ Repro.prototype.setLogLevel = function (logLevel, successCallback, errorCallback) {
14
14
  exec(successCallback, errorCallback, "Repro", "setLogLevel", [logLevel]);
15
15
  };
16
16
 
17
- Repro.prototype.setUserID = function(userId, successCallback, errorCallback) {
17
+ Repro.prototype.setUserID = function (userId, successCallback, errorCallback) {
18
18
  exec(successCallback, errorCallback, "Repro", "setUserID", [userId]);
19
19
  };
20
20
 
21
- Repro.prototype.setStringUserProfile = function(key, value, successCallback, errorCallback) {
21
+ Repro.prototype.setStringUserProfile = function (key, value, successCallback, errorCallback) {
22
22
  exec(successCallback, errorCallback, "Repro", "setStringUserProfile", [key, value]);
23
23
  };
24
24
 
25
- Repro.prototype.setIntUserProfile = function(key, value, successCallback, errorCallback) {
25
+ Repro.prototype.setIntUserProfile = function (key, value, successCallback, errorCallback) {
26
26
  exec(successCallback, errorCallback, "Repro", "setIntUserProfile", [key, value]);
27
27
  };
28
28
 
29
- Repro.prototype.setDoubleUserProfile = function(key, value, successCallback, errorCallback) {
29
+ Repro.prototype.setDoubleUserProfile = function (key, value, successCallback, errorCallback) {
30
30
  exec(successCallback, errorCallback, "Repro", "setDoubleUserProfile", [key, value]);
31
31
  };
32
32
 
33
- Repro.prototype.setDateUserProfile = function(key, value, successCallback, errorCallback) {
33
+ Repro.prototype.setDateUserProfile = function (key, value, successCallback, errorCallback) {
34
34
  exec(successCallback, errorCallback, "Repro", "setDateUserProfile", [key, value.getTime()]);
35
35
  };
36
36
 
37
- Repro.prototype.track = function(eventName, successCallback, errorCallback) {
37
+ Repro.prototype.track = function (eventName, successCallback, errorCallback) {
38
38
  exec(successCallback, errorCallback, "Repro", "track", [eventName]);
39
39
  };
40
40
 
41
- Repro.prototype.trackWithProperties = function(eventName, properties, successCallback, errorCallback) {
41
+ Repro.prototype.trackWithProperties = function (eventName, properties, successCallback, errorCallback) {
42
42
  exec(successCallback, errorCallback, "Repro", "trackWithProperties", [eventName, properties]);
43
43
  };
44
44
 
45
- Repro.prototype.trackViewContent = function(contentID, properties, successCallback, errorCallback) {
45
+ Repro.prototype.trackViewContent = function (contentID, properties, successCallback, errorCallback) {
46
46
  exec(successCallback, errorCallback, "Repro", "trackViewContent", [contentID, properties]);
47
47
  };
48
48
 
49
- Repro.prototype.trackSearch = function(properties, successCallback, errorCallback) {
49
+ Repro.prototype.trackSearch = function (properties, successCallback, errorCallback) {
50
50
  exec(successCallback, errorCallback, "Repro", "trackSearch", [properties]);
51
51
  };
52
52
 
53
- Repro.prototype.trackAddToCart = function(contentID, properties, successCallback, errorCallback) {
53
+ Repro.prototype.trackAddToCart = function (contentID, properties, successCallback, errorCallback) {
54
54
  exec(successCallback, errorCallback, "Repro", "trackAddToCart", [contentID, properties]);
55
55
  };
56
56
 
57
- Repro.prototype.trackAddToWishlist = function(properties, successCallback, errorCallback) {
57
+ Repro.prototype.trackAddToWishlist = function (properties, successCallback, errorCallback) {
58
58
  exec(successCallback, errorCallback, "Repro", "trackAddToWishlist", [properties]);
59
59
  };
60
60
 
61
- Repro.prototype.trackInitiateCheckout = function(properties, successCallback, errorCallback) {
61
+ Repro.prototype.trackInitiateCheckout = function (properties, successCallback, errorCallback) {
62
62
  exec(successCallback, errorCallback, "Repro", "trackInitiateCheckout", [properties]);
63
63
  };
64
64
 
65
- Repro.prototype.trackAddPaymentInfo = function(properties, successCallback, errorCallback) {
65
+ Repro.prototype.trackAddPaymentInfo = function (properties, successCallback, errorCallback) {
66
66
  exec(successCallback, errorCallback, "Repro", "trackAddPaymentInfo", [properties]);
67
67
  };
68
68
 
69
- Repro.prototype.trackPurchase = function(contentID, value, currency, properties, successCallback, errorCallback) {
69
+ Repro.prototype.trackPurchase = function (contentID, value, currency, properties, successCallback, errorCallback) {
70
70
  exec(successCallback, errorCallback, "Repro", "trackPurchase", [contentID, value, currency, properties]);
71
71
  };
72
72
 
73
- Repro.prototype.trackShare = function(properties, successCallback, errorCallback) {
73
+ Repro.prototype.trackShare = function (properties, successCallback, errorCallback) {
74
74
  exec(successCallback, errorCallback, "Repro", "trackShare", [properties]);
75
75
  };
76
76
 
77
- Repro.prototype.trackLead = function(properties, successCallback, errorCallback) {
77
+ Repro.prototype.trackLead = function (properties, successCallback, errorCallback) {
78
78
  exec(successCallback, errorCallback, "Repro", "trackLead", [properties]);
79
79
  };
80
80
 
81
- Repro.prototype.trackCompleteRegistration = function(properties, successCallback, errorCallback) {
81
+ Repro.prototype.trackCompleteRegistration = function (properties, successCallback, errorCallback) {
82
82
  exec(successCallback, errorCallback, "Repro", "trackCompleteRegistration", [properties]);
83
83
  };
84
84
 
85
- Repro.prototype.setPushDeviceToken = function(deviceToken, successCallback, errorCallback) {
85
+ Repro.prototype.setPushDeviceToken = function (deviceToken, successCallback, errorCallback) {
86
86
  // Deprecated
87
87
  };
88
88
 
89
- Repro.prototype.enablePushNotification = function(successCallback, errorCallback) {
89
+ Repro.prototype.enablePushNotification = function (successCallback, errorCallback) {
90
90
  exec(successCallback, errorCallback, "Repro", "enablePushNotification");
91
91
  };
92
92
 
93
- Repro.prototype.enablePushNotificationForAndroid = function(successCallback, errorCallback) {
93
+ Repro.prototype.enablePushNotificationForAndroid = function (successCallback, errorCallback) {
94
94
  exec(successCallback, errorCallback, "Repro", "enablePushNotification");
95
95
  };
96
96
 
97
- Repro.prototype.enablePushNotificationForIOS= function(successCallback, errorCallback) {
97
+ Repro.prototype.enablePushNotificationForIOS = function (successCallback, errorCallback) {
98
98
  exec(successCallback, errorCallback, "Repro", "enablePushNotificationForIOS", []);
99
99
  };
100
100
 
101
- Repro.prototype.enableInAppMessagesOnForegroundTransition = function(successCallback, errorCallback) {
101
+ Repro.prototype.enableInAppMessagesOnForegroundTransition = function (successCallback, errorCallback) {
102
102
  exec(successCallback, errorCallback, "Repro", "enableInAppMessagesOnForegroundTransition", []);
103
103
  };
104
104
 
105
- Repro.prototype.disableInAppMessagesOnForegroundTransition = function(successCallback, errorCallback) {
105
+ Repro.prototype.disableInAppMessagesOnForegroundTransition = function (successCallback, errorCallback) {
106
106
  exec(successCallback, errorCallback, "Repro", "disableInAppMessagesOnForegroundTransition", []);
107
107
  };
108
108
 
109
- Repro.prototype.getUserID = function(successCallback, errorCallback) {
109
+ Repro.prototype.getUserID = function (successCallback, errorCallback) {
110
110
  exec(successCallback, errorCallback, "Repro", "getUserID", []);
111
111
  };
112
112
 
113
- Repro.prototype.getDeviceID = function(successCallback, errorCallback) {
113
+ Repro.prototype.getDeviceID = function (successCallback, errorCallback) {
114
114
  exec(successCallback, errorCallback, "Repro", "getDeviceID", []);
115
115
  };
116
116
 
117
- Repro.prototype.trackNotificationOpened = function(notificationId, successCallback, errorCallback) {
117
+ Repro.prototype.trackNotificationOpened = function (notificationId, successCallback, errorCallback) {
118
118
  exec(successCallback, errorCallback, "Repro", "trackNotificationOpened", [notificationId]);
119
119
  };
120
120
 
121
- Repro.prototype.setSilverEggCookie = function(cookie, successCallback, errorCallback) {
121
+ Repro.prototype.setSilverEggCookie = function (cookie, successCallback, errorCallback) {
122
122
  exec(successCallback, errorCallback, "Repro", "setSilverEggCookie", [cookie]);
123
123
  };
124
124
 
125
- Repro.prototype.setSilverEggProdKey = function(prodKey, successCallback, errorCallback) {
125
+ Repro.prototype.setSilverEggProdKey = function (prodKey, successCallback, errorCallback) {
126
126
  exec(successCallback, errorCallback, "Repro", "setSilverEggProdKey", [prodKey]);
127
127
  };
128
128
 
129
- Repro.prototype.getNewsFeedsWithLimit = function(limit, successCallback, errorCallback) {
129
+ Repro.prototype.getNewsFeedsWithLimit = function (limit, successCallback, errorCallback) {
130
130
  exec(successCallback, errorCallback, "Repro", "getNewsFeedsWithLimit", [limit]);
131
131
  };
132
132
 
133
- Repro.prototype.getNewsFeedsWithLimitAndOffsetId = function(limit, offsetId, successCallback, errorCallback) {
133
+ Repro.prototype.getNewsFeedsWithLimitAndOffsetId = function (limit, offsetId, successCallback, errorCallback) {
134
134
  exec(successCallback, errorCallback, "Repro", "getNewsFeedsWithLimitAndOffsetId", [limit, offsetId]);
135
135
  };
136
136
 
137
- Repro.prototype.updateNewsFeeds = function(newsFeeds, successCallback, errorCallback) {
137
+ Repro.prototype.getNewsFeedsWithLimitAndCampaignType = function (limit, campaignType, successCallback, errorCallback) {
138
+ exec(successCallback, errorCallback, "Repro", "getNewsFeedsWithLimitAndCampaignType", [limit, campaignType]);
139
+ };
140
+
141
+ Repro.prototype.getNewsFeedsWithLimitAndOffsetIdAndCampaignType = function (limit, offsetId, campaignType, successCallback, errorCallback) {
142
+ exec(successCallback, errorCallback, "Repro", "getNewsFeedsWithLimitAndOffsetIdAndCampaignType", [limit, offsetId, campaignType]);
143
+ };
144
+
145
+ Repro.prototype.updateNewsFeeds = function (newsFeeds, successCallback, errorCallback) {
138
146
  exec(successCallback, errorCallback, "Repro", "updateNewsFeeds", [newsFeeds]);
139
147
  };
140
148
 
149
+ Repro.prototype.CampaignType = Object.freeze(
150
+ {
151
+ InAppMessage: "in_app_message",
152
+ PushNotification: "push_notification",
153
+ WebMessage: "web_message",
154
+ All: "all"
155
+ }
156
+ )
157
+
141
158
  module.exports = new Repro();