cordova-plugin-repro 6.6.0 → 6.9.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.9.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.9.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,6 @@
73
73
 
74
74
 
75
75
 
76
+
77
+
78
+
@@ -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.3",
3
+ "android-sdk": "5.6.3",
4
+ "bridge": "6.9.0"
5
5
  }
@@ -1,12 +1,16 @@
1
1
  package io.repro.cordova;
2
2
 
3
+ import android.app.AppOpsManager;
3
4
  import android.content.Context;
4
5
  import android.graphics.Point;
5
6
  import android.graphics.Rect;
6
7
  import android.view.Display;
7
8
  import android.view.WindowManager;
8
9
 
10
+ import java.lang.reflect.Field;
11
+ import java.lang.reflect.Method;
9
12
  import java.text.SimpleDateFormat;
13
+ import java.util.EnumSet;
10
14
  import java.util.Date;
11
15
  import java.util.HashMap;
12
16
  import java.util.Iterator;
@@ -19,6 +23,8 @@ import java.util.TimeZone;
19
23
  import org.apache.cordova.CallbackContext;
20
24
  import org.apache.cordova.CordovaArgs;
21
25
 
26
+ import org.apache.cordova.CordovaWebView;
27
+ import org.apache.cordova.LOG;
22
28
  import org.json.JSONArray;
23
29
  import org.json.JSONException;
24
30
  import org.json.JSONObject;
@@ -26,6 +32,7 @@ import org.json.JSONObject;
26
32
  import io.repro.android.Repro;
27
33
  import io.repro.android.CordovaBridge;
28
34
  import io.repro.android.newsfeed.NewsFeedEntry;
35
+ import io.repro.android.newsfeed.NewsFeedCampaignType;
29
36
 
30
37
  /**
31
38
  * Created by nekoe on 1/15/16.
@@ -33,6 +40,8 @@ import io.repro.android.newsfeed.NewsFeedEntry;
33
40
  */
34
41
  public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
35
42
 
43
+ private static final String REPRO_CORDOVA_BRIDGE_VERSION = "6.9.0";
44
+
36
45
  private static SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
37
46
 
38
47
  static {
@@ -137,6 +146,12 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
137
146
  else if ("getNewsFeedsWithLimitAndOffsetId".equals(action)) {
138
147
  return getNewsFeedsWithLimitAndOffsetId(args, callbackContext);
139
148
  }
149
+ else if ("getNewsFeedsWithLimitAndCampaignType".equals(action)) {
150
+ return getNewsFeedsWithLimitAndCampaignType(args, callbackContext);
151
+ }
152
+ else if ("getNewsFeedsWithLimitAndOffsetIdAndCampaignType".equals(action)) {
153
+ return getNewsFeedsWithLimitAndOffsetIdAndCampaignType(args, callbackContext);
154
+ }
140
155
  else if ("updateNewsFeeds".equals(action)) {
141
156
  return updateNewsFeeds(args, callbackContext);
142
157
  }
@@ -144,13 +159,37 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
144
159
  return false;
145
160
  }
146
161
 
162
+ private void passPlatformValues() {
163
+ final Map<String, Object> platformValues = new HashMap<>();
164
+ platformValues.put("sub_sdk_platform", "cordova");
165
+ platformValues.put("sub_sdk_bridge_version", REPRO_CORDOVA_BRIDGE_VERSION);
166
+
167
+ try {
168
+ Class cordovaKlass = Class.forName("org.apache.cordova.CordovaWebView");
169
+ Field verField = cordovaKlass.getDeclaredField("CORDOVA_VERSION");
170
+ platformValues.put("sub_sdk_platform_version", (String)verField.get(null)); // null because static field
171
+ } catch (Throwable t) {
172
+ t.printStackTrace();
173
+ }
174
+
175
+ try {
176
+ Method method = Repro.class.getDeclaredMethod("_passRuntimeValues", Map.class);
177
+ method.setAccessible(true);
178
+ method.invoke(null, platformValues);
179
+ } catch (Throwable t) {
180
+ t.printStackTrace();
181
+ }
182
+ }
183
+
147
184
  // API implementation
185
+ // CordovaArgs: https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaArgs.java
148
186
 
149
187
  private boolean setup(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
150
188
  final String token = args.getString(0);
151
189
 
152
190
  callAPI(new API(callbackContext) {
153
191
  Void api() {
192
+ passPlatformValues();
154
193
  CordovaBridge.startSession(token);
155
194
  return null;
156
195
  }
@@ -623,7 +662,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
623
662
 
624
663
  private boolean getNewsFeedsWithLimit(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
625
664
  final Object limit = args.opt(0);
626
- if (!isValidNewsFeedRequestParam(limit)) {
665
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
627
666
  android.util.Log.e("Repro", "Didn't get NewsFeed: limit should be Number and more than 0.");
628
667
  return true;
629
668
  }
@@ -649,13 +688,13 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
649
688
 
650
689
  private boolean getNewsFeedsWithLimitAndOffsetId(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
651
690
  final Object limit = args.opt(0);
652
- if (!isValidNewsFeedRequestParam(limit)) {
691
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
653
692
  android.util.Log.e("Repro", "Didn't get NewsFeed: limit should be Number and more than 0.");
654
693
  return true;
655
694
  }
656
695
 
657
696
  final Object offsetId = args.opt(1);
658
- if (!isValidNewsFeedRequestParam(offsetId)) {
697
+ if (!isValidNewsFeedRequestNumericParam(offsetId)) {
659
698
  android.util.Log.e("Repro", "Didn't get NewsFeed: offset id should be Number and more than 0.");
660
699
  return true;
661
700
  }
@@ -679,7 +718,85 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
679
718
  return true;
680
719
  }
681
720
 
682
- private boolean isValidNewsFeedRequestParam(Object param) {
721
+ private boolean getNewsFeedsWithLimitAndCampaignType(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
722
+ final Object limit = args.opt(0);
723
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
724
+ android.util.Log.e("Repro", "Cannot get NewsFeed: limit should be Number and more than 0.");
725
+ return true;
726
+ }
727
+
728
+ final NewsFeedCampaignType mappedCampaignType = mapToCampaignTypes(args.optString(1));
729
+ cordova.getThreadPool().execute(new Runnable() {
730
+ @Override
731
+ public void run() {
732
+ JSONArray arr = new JSONArray();
733
+ try {
734
+ List<NewsFeedEntry> newsFeedEntries = Repro.getNewsFeeds(((Number) limit).intValue(), mappedCampaignType);
735
+ for (NewsFeedEntry newsFeedEntry : newsFeedEntries) {
736
+ arr.put(newsFeedEntryToJSONObject(newsFeedEntry));
737
+ }
738
+ callbackContext.success(arr);
739
+ } catch (Exception e) {
740
+ callbackContext.error("Failed to get NewsFeeds: " + e.getMessage());
741
+ }
742
+ }
743
+ });
744
+
745
+ return true;
746
+ }
747
+
748
+ private boolean getNewsFeedsWithLimitAndOffsetIdAndCampaignType(final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
749
+ final Object limit = args.opt(0);
750
+ if (!isValidNewsFeedRequestNumericParam(limit)) {
751
+ android.util.Log.e("Repro", "Cannot get NewsFeed: limit should be Number and more than 0.");
752
+ return true;
753
+ }
754
+
755
+ final Object offsetId = args.opt(1);
756
+ if (!isValidNewsFeedRequestNumericParam(offsetId)) {
757
+ android.util.Log.e("Repro", "Cannot get NewsFeed: offset id should be Number and more than 0.");
758
+ return true;
759
+ }
760
+
761
+ final NewsFeedCampaignType mappedCampaignType = mapToCampaignTypes(args.optString(2));
762
+ cordova.getThreadPool().execute(new Runnable() {
763
+ @Override
764
+ public void run() {
765
+ JSONArray arr = new JSONArray();
766
+ try {
767
+ List<NewsFeedEntry> newsFeedEntries = Repro.getNewsFeeds(((Number) limit).intValue(), ((Number) offsetId).intValue(), mappedCampaignType);
768
+ for (NewsFeedEntry newsFeedEntry : newsFeedEntries) {
769
+ arr.put(newsFeedEntryToJSONObject(newsFeedEntry));
770
+ }
771
+ callbackContext.success(arr);
772
+ } catch (Exception e) {
773
+ callbackContext.error("Failed to get NewsFeeds: " + e.getMessage());
774
+ }
775
+ }
776
+ });
777
+
778
+ return true;
779
+ }
780
+
781
+ private NewsFeedCampaignType mapToCampaignTypes(final String campaignType) {
782
+ if (campaignType == null) {
783
+ return NewsFeedCampaignType.Unknown;
784
+ }
785
+
786
+ if (campaignType.equals(NewsFeedCampaignType.PushNotification.getValue())) {
787
+ return NewsFeedCampaignType.PushNotification;
788
+ } else if (campaignType.equals(NewsFeedCampaignType.InAppMessage.getValue())) {
789
+ return NewsFeedCampaignType.InAppMessage;
790
+ } else if (campaignType.equals(NewsFeedCampaignType.WebMessage.getValue())) {
791
+ return NewsFeedCampaignType.WebMessage;
792
+ } else if (campaignType.equals(NewsFeedCampaignType.All.getValue())) {
793
+ return NewsFeedCampaignType.All;
794
+ } else {
795
+ return NewsFeedCampaignType.Unknown;
796
+ }
797
+ }
798
+
799
+ private boolean isValidNewsFeedRequestNumericParam(Object param) {
683
800
  return param instanceof Number && ((Number) param).intValue() > 0;
684
801
  }
685
802
 
@@ -696,6 +813,7 @@ public final class CordovaPlugin extends org.apache.cordova.CordovaPlugin {
696
813
  entryObject.put("link_url", linkUrl);
697
814
  entryObject.put("image_url", imageUrl);
698
815
  entryObject.put("delivered_at", sDateFormat.format(entry.deliveredAt));
816
+ entryObject.put("campaign_type", entry.campaignType.getValue());
699
817
  entryObject.put("shown", entry.shown);
700
818
  entryObject.put("read", entry.read);
701
819
 
Binary file
@@ -26,18 +26,5 @@ buildscript {
26
26
 
27
27
  dependencies {
28
28
  classpath 'com.android.tools.build:gradle:+'
29
- classpath 'com.google.gms:google-services:4.0.2'
30
29
  }
31
30
  }
32
-
33
- cdvPluginPostBuildExtras.add({
34
- def skipGoogleServicesPluginApply = false
35
- project.rootDir.eachDir { dir ->
36
- if (dir.getName() == "cordova-support-google-services" || dir.getName() == "phonegap-plugin-push") {
37
- skipGoogleServicesPluginApply = true
38
- }
39
- }
40
- if(!skipGoogleServicesPluginApply && project.plugins.findPlugin("com.google.gms.google-services") == null) {
41
- apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
42
- }
43
- })
@@ -7,6 +7,8 @@
7
7
 
8
8
  #import <Cordova/CDV.h>
9
9
 
10
+ #define REPRO_CORDOVA_BRIDGE_VERSION "6.9.0"
11
+
10
12
  @interface CDVRepro : CDVPlugin
11
13
 
12
14
  @end
@@ -13,12 +13,38 @@
13
13
  #import "CDVRepro.h"
14
14
  #import "CDVReproEventPropertiesFactory.h"
15
15
 
16
+
17
+ #if __has_include(<Cordova/CDVAvailability.h>)
18
+ #import <Cordova/CDVAvailability.h>
19
+ #elif __has_include("CDVAvailability.h")
20
+ #import "CDVAvailability.h"
21
+ #elif __has_include("Cordova/CDVAvailability.h")
22
+ #import "Cordova/CDVAvailability.h"
23
+ #endif
24
+
25
+
16
26
  #define isNSNumber(OBJECT) ([OBJECT isKindOfClass:NSNumber.class])
17
27
 
28
+
29
+ @interface Repro (NonPublicApi)
30
+ + (void)_passRuntimeValues:(nonnull NSDictionary<NSString *, NSString *> *)values;
31
+ @end
32
+
33
+
18
34
  @implementation CDVRepro
19
35
 
20
36
  - (void)setup:(CDVInvokedUrlCommand*)command
21
37
  {
38
+ if ([Repro respondsToSelector:@selector(_passRuntimeValues:)]) {
39
+ [Repro _passRuntimeValues:@{
40
+ @"sub_sdk_platform": @"cordova",
41
+ #ifdef CDV_VERSION
42
+ @"sub_sdk_platform_version": CDV_VERSION,
43
+ #endif
44
+ @"sub_sdk_bridge_version": [NSString stringWithUTF8String:REPRO_CORDOVA_BRIDGE_VERSION],
45
+ }];
46
+ }
47
+
22
48
  NSString *key = [command.arguments objectAtIndex:0];
23
49
  [Repro setup:key];
24
50
  }
@@ -418,6 +444,104 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
418
444
  }];
419
445
  }
420
446
 
447
+ - (void)getNewsFeedsWithLimitAndCampaignType:(CDVInvokedUrlCommand*)command
448
+ {
449
+ NSNumber* limit = [command.arguments objectAtIndex:0];
450
+ if (![self isValidNewsFeedRequestParam:limit]) {
451
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: limit should be Number and more than 0.");
452
+ return;
453
+ }
454
+
455
+ NSString* rawCampaignType = [command.arguments objectAtIndex:1];
456
+ RPRCampaignType convertedCampaigntype = [self getNewsFeedCampaignType:rawCampaignType];
457
+
458
+ [self.commandDelegate runInBackground:^{
459
+ NSError *error = nil;
460
+ NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:[limit unsignedLongLongValue] campaignType:convertedCampaigntype error:&error];
461
+
462
+ if (error)
463
+ {
464
+ NSString *errString = [error localizedDescription];
465
+ NSString *errMessage = [NSString.alloc initWithFormat:@"Failed to get NewsFeeds: %@", errString];
466
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMessage];
467
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
468
+ return;
469
+ }
470
+
471
+ NSMutableArray<NSDictionary *> *arr = [NSMutableArray.alloc initWithCapacity:entries.count];
472
+ for (RPRNewsFeedEntry *entry in entries) {
473
+ [arr addObject:[self newsFeedEntryToDictionary:entry]];
474
+ }
475
+
476
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:arr];
477
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
478
+ }];
479
+ }
480
+
481
+ - (void)getNewsFeedsWithLimitAndOffsetIdAndCampaignType:(CDVInvokedUrlCommand*)command
482
+ {
483
+ NSNumber* limit = [command.arguments objectAtIndex:0];
484
+ if (![self isValidNewsFeedRequestParam:limit]) {
485
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: limit should be Number and more than 0.");
486
+ return;
487
+ }
488
+
489
+ NSNumber* offsetId = [command.arguments objectAtIndex:1];
490
+ if (![self isValidNewsFeedRequestParam:offsetId])
491
+ {
492
+ NSLog(@"ERROR: Repro Didn't get NewsFeed: offset id should be Number and more than 0.");
493
+ return;
494
+ }
495
+
496
+ NSString* rawCampaignType = [command.arguments objectAtIndex:2];
497
+ RPRCampaignType convertedCampaigntype = [self getNewsFeedCampaignType:rawCampaignType];
498
+
499
+ [self.commandDelegate runInBackground:^{
500
+ NSError *error = nil;
501
+ NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:[limit unsignedLongLongValue] offsetID:[offsetId unsignedLongLongValue] campaignType:convertedCampaigntype error:&error];
502
+
503
+ if (error)
504
+ {
505
+ NSString *errString = [error localizedDescription];
506
+ NSString *errMessage = [NSString.alloc initWithFormat:@"Failed to get NewsFeeds: %@", errString];
507
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMessage];
508
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
509
+ return;
510
+ }
511
+
512
+ NSMutableArray<NSDictionary *> *arr = [NSMutableArray.alloc initWithCapacity:entries.count];
513
+ for (RPRNewsFeedEntry *entry in entries) {
514
+ [arr addObject:[self newsFeedEntryToDictionary:entry]];
515
+ }
516
+
517
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:arr];
518
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
519
+ }];
520
+ }
521
+
522
+ - (RPRCampaignType)getNewsFeedCampaignType:(nullable NSString *)rawCampaignType
523
+ {
524
+ if (![rawCampaignType isKindOfClass:NSString.class]) {
525
+ return RPRCampaignTypeUnknown;
526
+ }
527
+
528
+ if ([rawCampaignType isEqualToString:@"push_notification"]) {
529
+ return RPRCampaignTypePushNotification;
530
+ }
531
+ else if ([rawCampaignType isEqualToString:@"in_app_message"]) {
532
+ return RPRCampaignTypeInAppMessage;
533
+ }
534
+ else if ([rawCampaignType isEqualToString:@"web_message"]) {
535
+ return RPRCampaignTypeWebMessage;
536
+ }
537
+ else if ([rawCampaignType isEqualToString:@"all"]) {
538
+ return RPRCampaignTypeAll;
539
+ }
540
+ else {
541
+ return RPRCampaignTypeUnknown;
542
+ }
543
+ }
544
+
421
545
  - (NSDictionary*)newsFeedEntryToDictionary:(RPRNewsFeedEntry *)entry
422
546
  {
423
547
  NSDictionary *entryJson = @{
@@ -429,6 +553,7 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
429
553
  @"shown": @(entry.shown),
430
554
  @"read": @(entry.read),
431
555
  @"delivered_at": [[self dateFormatter] stringFromDate:entry.deliveredAt],
556
+ @"campaign_type": [self convertCampaignTypeToString:entry.campaignType],
432
557
  @"link_url": entry.linkUrl ? [entry.linkUrl absoluteString] : @"",
433
558
  @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @""
434
559
  };
@@ -486,4 +611,21 @@ static NSDictionary* convertNSStringJSONToNSDictionary(NSString* json) {
486
611
  }];
487
612
  }
488
613
 
614
+ - (NSString *)convertCampaignTypeToString:(RPRCampaignType)campaignType
615
+ {
616
+ switch (campaignType) {
617
+ case RPRCampaignTypePushNotification:
618
+ return @"push_notification";
619
+ case RPRCampaignTypeInAppMessage:
620
+ return @"in_app_message";
621
+ case RPRCampaignTypeWebMessage:
622
+ return @"web_message";
623
+ case RPRCampaignTypeAll:
624
+ return @"all";
625
+
626
+ default:
627
+ return @"unknown";
628
+ }
629
+ }
630
+
489
631
  @end
@@ -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;
@@ -98,11 +98,11 @@ NS_SWIFT_NAME(value(forKey:));
98
98
  /// Access to remote config values via subscript syntax.
99
99
  - (nonnull RPRRemoteConfigValue *)objectForKeyedSubscript:(nonnull NSString *)key;
100
100
 
101
- /// Return a dictonary with all key value pairs.
101
+ /// Return a dictionary with all key value pairs.
102
102
  - (nonnull NSDictionary<NSString *, RPRRemoteConfigValue *> *)allValues
103
103
  NS_SWIFT_NAME(allValues());
104
104
 
105
- /// Return a dictonary with all key value pairs for a given prefix. Pass `nil` or an empty string to get all values.
105
+ /// Return a dictionary with all key value pairs for a given prefix. Pass `nil` or an empty string to get all values.
106
106
  - (nonnull NSDictionary<NSString *, RPRRemoteConfigValue *> *)allValuesWithPrefix:(nullable NSString *)prefix
107
107
  NS_SWIFT_NAME(allValues(withPrefix:));
108
108
 
@@ -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;
@@ -98,11 +98,11 @@ NS_SWIFT_NAME(value(forKey:));
98
98
  /// Access to remote config values via subscript syntax.
99
99
  - (nonnull RPRRemoteConfigValue *)objectForKeyedSubscript:(nonnull NSString *)key;
100
100
 
101
- /// Return a dictonary with all key value pairs.
101
+ /// Return a dictionary with all key value pairs.
102
102
  - (nonnull NSDictionary<NSString *, RPRRemoteConfigValue *> *)allValues
103
103
  NS_SWIFT_NAME(allValues());
104
104
 
105
- /// Return a dictonary with all key value pairs for a given prefix. Pass `nil` or an empty string to get all values.
105
+ /// Return a dictionary with all key value pairs for a given prefix. Pass `nil` or an empty string to get all values.
106
106
  - (nonnull NSDictionary<NSString *, RPRRemoteConfigValue *> *)allValuesWithPrefix:(nullable NSString *)prefix
107
107
  NS_SWIFT_NAME(allValues(withPrefix:));
108
108
 
@@ -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();