react-native-repro 3.6.0 → 3.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.
Files changed (31) hide show
  1. package/android/build.gradle +2 -4
  2. package/android/src/main/java/io/repro/android/reactbridge/ReproReactBridgeModule.java +89 -4
  3. package/index.js +41 -3
  4. package/ios/RPRReproReactBridge.h +5 -0
  5. package/ios/RPRReproReactBridge.m +126 -6
  6. package/package.json +2 -2
  7. package/repro-version.json +3 -3
  8. package/sdk-android/io/repro/repro-android-sdk/5.6.3/repro-android-sdk-5.6.3.aar +0 -0
  9. package/sdk-android/io/repro/repro-android-sdk/5.6.3/repro-android-sdk-5.6.3.aar.md5 +1 -0
  10. package/sdk-android/io/repro/repro-android-sdk/5.6.3/repro-android-sdk-5.6.3.aar.sha1 +1 -0
  11. package/sdk-android/io/repro/repro-android-sdk/{5.5.1/repro-android-sdk-5.5.1.pom → 5.6.3/repro-android-sdk-5.6.3.pom} +1 -1
  12. package/sdk-android/io/repro/repro-android-sdk/5.6.3/repro-android-sdk-5.6.3.pom.md5 +1 -0
  13. package/sdk-android/io/repro/repro-android-sdk/5.6.3/repro-android-sdk-5.6.3.pom.sha1 +1 -0
  14. package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml +3 -3
  15. package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml.md5 +1 -1
  16. package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml.sha1 +1 -1
  17. package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Headers/RPRNewsFeedEntry.h +11 -0
  18. package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Headers/RPRRemoteConfig.h +2 -2
  19. package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Headers/Repro.h +11 -0
  20. package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Info.plist +0 -0
  21. package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Repro +0 -0
  22. package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Headers/RPRNewsFeedEntry.h +11 -0
  23. package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Headers/RPRRemoteConfig.h +2 -2
  24. package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Headers/Repro.h +11 -0
  25. package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Info.plist +0 -0
  26. package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Repro +0 -0
  27. package/sdk-android/io/repro/repro-android-sdk/5.5.1/repro-android-sdk-5.5.1.aar +0 -0
  28. package/sdk-android/io/repro/repro-android-sdk/5.5.1/repro-android-sdk-5.5.1.aar.md5 +0 -1
  29. package/sdk-android/io/repro/repro-android-sdk/5.5.1/repro-android-sdk-5.5.1.aar.sha1 +0 -1
  30. package/sdk-android/io/repro/repro-android-sdk/5.5.1/repro-android-sdk-5.5.1.pom.md5 +0 -1
  31. package/sdk-android/io/repro/repro-android-sdk/5.5.1/repro-android-sdk-5.5.1.pom.sha1 +0 -1
@@ -23,10 +23,8 @@ repositories {
23
23
  }
24
24
 
25
25
  dependencies {
26
- compile "com.facebook.react:react-native:${getMainProp('reactNativeVersion', '+')}"
26
+ implementation "com.facebook.react:react-native:${getMainProp('reactNativeVersion', '+')}"
27
27
 
28
- // NOTE: In order to use new gradle versions change 'compile' not to 'implementation' but instead
29
- // change it to 'api' in order to expose Repro library functions to the gradle main project.
30
- compile "io.repro:repro-android-sdk:+"
28
+ api "io.repro:repro-android-sdk:+"
31
29
  }
32
30
 
@@ -14,8 +14,12 @@ import com.facebook.react.bridge.WritableArray;
14
14
  import com.facebook.react.bridge.WritableNativeArray;
15
15
  import com.facebook.react.bridge.ReadableArray;
16
16
  import com.facebook.react.bridge.Arguments;
17
+ import com.facebook.react.modules.systeminfo.ReactNativeVersion;
17
18
 
19
+ import java.lang.reflect.Method;
20
+ import java.util.EnumSet;
18
21
  import java.util.HashMap;
22
+ import java.util.Iterator;
19
23
  import java.util.Map;
20
24
  import java.util.ArrayList;
21
25
  import java.util.List;
@@ -26,6 +30,7 @@ import java.util.Date;
26
30
  import org.json.JSONObject;
27
31
 
28
32
  import io.repro.android.Repro;
33
+ import io.repro.android.newsfeed.NewsFeedCampaignType;
29
34
  import io.repro.android.tracking.AddPaymentInfoProperties;
30
35
  import io.repro.android.tracking.AddToCartProperties;
31
36
  import io.repro.android.tracking.AddToWishlistProperties;
@@ -46,11 +51,51 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
46
51
  public static final int GENDER_MALE = 1;
47
52
  public static final int GENDER_FEMALE = 2;
48
53
 
54
+ public static final int CAMPAIGN_TYPE_UNKNOWN = 0;
55
+ public static final int CAMPAIGN_TYPE_PUSH_NOTIFICATION = (1 << 0);
56
+ public static final int CAMPAIGN_TYPE_IN_APP_MESSAGE = (1 << 1);
57
+ public static final int CAMPAIGN_TYPE_WEB_MESSAGE = (1 << 2);
58
+ public static final int CAMPAIGN_TYPE_ALL = (1 << 3);
59
+
49
60
  private final ReactApplicationContext reactContext;
50
61
 
62
+ private static final String REPRO_REACT_NATIVE_BRIDGE_VERSION = "3.9.0";
63
+
51
64
  public ReproReactBridgeModule(ReactApplicationContext reactContext) {
52
65
  super(reactContext);
53
66
  this.reactContext = reactContext;
67
+ this.versionPassing();
68
+ }
69
+
70
+ private String getReactNativeVersion() {
71
+ try {
72
+ return String.format(Locale.US, "%d.%d.%d",
73
+ ReactNativeVersion.VERSION.get("major"),
74
+ ReactNativeVersion.VERSION.get("minor"),
75
+ ReactNativeVersion.VERSION.get("patch")
76
+ );
77
+ } catch (Throwable t) {
78
+ return null;
79
+ }
80
+ }
81
+
82
+ private void versionPassing() {
83
+ final Map<String, Object> platformValues = new HashMap<>();
84
+ platformValues.put("sub_sdk_platform", "react_native");
85
+ platformValues.put("sub_sdk_bridge_version", REPRO_REACT_NATIVE_BRIDGE_VERSION);
86
+
87
+ String rnVerString = getReactNativeVersion();
88
+ if (rnVerString != null) {
89
+ platformValues.put("sub_sdk_platform_version", rnVerString);
90
+ }
91
+
92
+ try {
93
+ Method method = Repro.class.getDeclaredMethod("_passRuntimeValues", Map.class);
94
+ method.setAccessible(true);
95
+ method.invoke(null, platformValues);
96
+ } catch (Throwable t) {
97
+ t.printStackTrace();
98
+ }
54
99
  }
55
100
 
56
101
  @Override
@@ -71,6 +116,12 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
71
116
  constants.put("LOGLEVEL_WARN", Log.WARN);
72
117
  constants.put("LOGLEVEL_ERROR", Log.ERROR);
73
118
 
119
+ constants.put("CAMPAIGN_TYPE_UNKNOWN", CAMPAIGN_TYPE_UNKNOWN);
120
+ constants.put("CAMPAIGN_TYPE_PUSH_NOTIFICATION", CAMPAIGN_TYPE_PUSH_NOTIFICATION);
121
+ constants.put("CAMPAIGN_TYPE_IN_APP_MESSAGE", CAMPAIGN_TYPE_IN_APP_MESSAGE);
122
+ constants.put("CAMPAIGN_TYPE_WEB_MESSAGE", CAMPAIGN_TYPE_WEB_MESSAGE);
123
+ constants.put("CAMPAIGN_TYPE_ALL", CAMPAIGN_TYPE_ALL);
124
+
74
125
  return constants;
75
126
  }
76
127
 
@@ -347,6 +398,7 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
347
398
  entryMap.putString("title", entry.title);
348
399
  entryMap.putString("summary", entry.summary);
349
400
  entryMap.putString("body", entry.body);
401
+ entryMap.putInt("campaign_type", convertCampaignTypeToInt(entry.campaignType));
350
402
 
351
403
  entryMap.putBoolean("shown", entry.shown);
352
404
  entryMap.putBoolean("read", entry.read);
@@ -363,9 +415,11 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
363
415
  }
364
416
 
365
417
  @ReactMethod
366
- public void getNewsFeeds(final int limit, Callback callback) {
418
+ public void getNewsFeeds(final int limit, final int campaignType, Callback callback) {
419
+ NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
420
+
367
421
  try {
368
- callback.invoke(null, toWritableArray(Repro.getNewsFeeds(limit)));
422
+ callback.invoke(null, toWritableArray(Repro.getNewsFeeds(limit, type)));
369
423
  } catch (Exception e) {
370
424
  WritableMap entryMap = Arguments.createMap();
371
425
  entryMap.putString("message", e.getMessage());
@@ -374,9 +428,11 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
374
428
  }
375
429
 
376
430
  @ReactMethod
377
- public void getNewsFeedsFor(final int limit, final int offsetID, Callback callback) {
431
+ public void getNewsFeedsFor(final int limit, final int offsetID, final int campaignType, Callback callback) {
432
+ NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
433
+
378
434
  try {
379
- callback.invoke(null, toWritableArray(Repro.getNewsFeeds(limit, offsetID)));
435
+ callback.invoke(null, toWritableArray(Repro.getNewsFeeds(limit, offsetID, type)));
380
436
  } catch (Exception e) {
381
437
  WritableMap entryMap = Arguments.createMap();
382
438
  entryMap.putString("message", e.getMessage());
@@ -402,6 +458,35 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
402
458
  callback.invoke(error);
403
459
  }
404
460
  }
461
+
462
+ private NewsFeedCampaignType convertCampaignTypeFromInt(int type) {
463
+ switch (type) {
464
+ case CAMPAIGN_TYPE_PUSH_NOTIFICATION:
465
+ return NewsFeedCampaignType.PushNotification;
466
+ case CAMPAIGN_TYPE_IN_APP_MESSAGE:
467
+ return NewsFeedCampaignType.InAppMessage;
468
+ case CAMPAIGN_TYPE_WEB_MESSAGE:
469
+ return NewsFeedCampaignType.WebMessage;
470
+ case CAMPAIGN_TYPE_ALL:
471
+ return NewsFeedCampaignType.All;
472
+ }
473
+
474
+ return NewsFeedCampaignType.Unknown;
475
+ }
476
+ private int convertCampaignTypeToInt(NewsFeedCampaignType type) {
477
+ switch (type.toString()) {
478
+ case "push_notification":
479
+ return CAMPAIGN_TYPE_PUSH_NOTIFICATION;
480
+ case "in_app_message":
481
+ return CAMPAIGN_TYPE_IN_APP_MESSAGE;
482
+ case "web_message":
483
+ return CAMPAIGN_TYPE_WEB_MESSAGE;
484
+ case "all":
485
+ return CAMPAIGN_TYPE_ALL;
486
+ }
487
+
488
+ return CAMPAIGN_TYPE_UNKNOWN;
489
+ }
405
490
  }
406
491
 
407
492
 
package/index.js CHANGED
@@ -15,6 +15,7 @@ class NewsFeedEntry {
15
15
  this.title = value["title"];
16
16
  this.summary = value["summary"];
17
17
  this.body = safeString(value["body"]);
18
+ this.campaignType = value["campaign_type"];
18
19
  this.shown = value["shown"];
19
20
  this.read = value["read"];
20
21
 
@@ -27,10 +28,11 @@ class NewsFeedEntry {
27
28
  toJson() {
28
29
  return {
29
30
  "newsfeed_id": this.id,
30
- "deviceID": this.deviceID,
31
+ "device_id": this.deviceID,
31
32
  "title": this.title,
32
33
  "summary": this.summary,
33
34
  "body": this.body,
35
+ "campaign_type": this.campaignType,
34
36
  "shown": this.shown,
35
37
  "read": this.read,
36
38
  "delivered_at": this.deliveredAt,
@@ -42,7 +44,25 @@ class NewsFeedEntry {
42
44
 
43
45
  const NewsFeedModule = {
44
46
  getNewsFeeds: (limit, callback) => {
45
- NativeModules.Repro.getNewsFeeds(limit, (error, items) => {
47
+ NativeModules.Repro.getNewsFeeds(limit, NativeModules.Repro.CAMPAIGN_TYPE_PUSH_NOTIFICATION, (error, items) => {
48
+ if (!callback) return;
49
+ if (!items) {
50
+ callback(null, []);
51
+ return;
52
+ }
53
+
54
+ const newsFeeds = [];
55
+
56
+ for (const item of items) {
57
+ newsFeeds.push(new NewsFeedEntry(item));
58
+ }
59
+
60
+ callback(error, newsFeeds);
61
+ })
62
+ },
63
+
64
+ getNewsFeedsWithCampaignType: (limit, campaignType, callback) => {
65
+ NativeModules.Repro.getNewsFeeds(limit, campaignType, (error, items) => {
46
66
  if (!callback) return;
47
67
  if (!items) {
48
68
  callback(null, []);
@@ -60,7 +80,25 @@ const NewsFeedModule = {
60
80
  },
61
81
 
62
82
  getNewsFeedsFor: (limit, offsetID, callback) => {
63
- NativeModules.Repro.getNewsFeedsFor(limit, offsetID, (error, items) => {
83
+ NativeModules.Repro.getNewsFeedsFor(limit, offsetID, NativeModules.Repro.CAMPAIGN_TYPE_PUSH_NOTIFICATION, (error, items) => {
84
+ if (!callback) return;
85
+ if (!items) {
86
+ callback(null, []);
87
+ return;
88
+ }
89
+
90
+ const newsFeeds = [];
91
+
92
+ for (const item of items) {
93
+ newsFeeds.push(new NewsFeedEntry(item));
94
+ }
95
+
96
+ callback(error, newsFeeds);
97
+ })
98
+ },
99
+
100
+ getNewsFeedsWithCampaignTypeFor: (limit, offsetID, campaignType, callback) => {
101
+ NativeModules.Repro.getNewsFeedsFor(limit, offsetID, campaignType, (error, items) => {
64
102
  if (!callback) return;
65
103
  if (!items) {
66
104
  callback(null, []);
@@ -25,6 +25,11 @@
25
25
  #error "Can't find RCTBridgeModule.h anywhere."
26
26
  #endif
27
27
 
28
+
29
+ #define REPRO_REACT_NATIVE_BRIDGE_VERSION "3.9.0"
30
+
31
+
32
+
28
33
  @interface RPRRemoteConfigBridge: NSObject <RCTBridgeModule>
29
34
 
30
35
  @end
@@ -29,6 +29,31 @@
29
29
  #error "Can't find RCTConvert.h anywhere."
30
30
  #endif
31
31
 
32
+
33
+
34
+
35
+ // ReactNative Version >= 0.41
36
+ #if __has_include(<React/RCTVersion.h>)
37
+ #import <React/RCTVersion.h>
38
+
39
+ // ReactNative Version < 0.41
40
+ #elif __has_include("RCTVersion.h")
41
+ #import "RCTVersion.h"
42
+
43
+ // if ReactNative is a cocoapod and the project has swift enabled
44
+ #elif __has_include("React/RCTVersion.h")
45
+ #import "React/RCTVersion.h"
46
+
47
+ #else
48
+ #define RPR_CANT_DETERMINE_RN_VERSION 1
49
+ #endif
50
+
51
+
52
+
53
+
54
+
55
+
56
+
32
57
  static NSObject*
33
58
  safe_value(id value)
34
59
  {
@@ -61,6 +86,15 @@ safe_value(id value)
61
86
  RPRRemoteConfigFetchStatusTimeoutReached, integerValue)
62
87
  @end
63
88
 
89
+ @implementation RCTConvert (RPRCampaignType)
90
+ RCT_ENUM_CONVERTER(RPRCampaignType, (@{
91
+ @"CAMPAIGN_TYPE_UNKNOWN" : @(RPRCampaignTypeUnknown),
92
+ @"CAMPAIGN_TYPE_PUSH_NOTIFICATION" : @(RPRCampaignTypePushNotification),
93
+ @"CAMPAIGN_TYPE_IN_APP_MESSAGE" : @(RPRCampaignTypeInAppMessage),
94
+ @"CAMPAIGN_TYPE_WEB_MESSAGE" : @(RPRCampaignTypeWebMessage)}),
95
+ RPRCampaignTypePushNotification, integerValue)
96
+ @end
97
+
64
98
  @interface RPRRemoteConfigBridge ()
65
99
 
66
100
  @property (nonatomic) RPRRemoteConfig* remoteConfig;
@@ -177,8 +211,58 @@ RCT_EXPORT_METHOD(forceReset)
177
211
  @end
178
212
 
179
213
 
214
+
215
+
216
+ @interface Repro (NonPublicApi)
217
+ + (void)_passRuntimeValues:(nonnull NSDictionary<NSString *, NSString *> *)values;
218
+ @end
219
+
220
+
221
+
222
+
223
+ #ifndef RPR_CANT_DETERMINE_RN_VERSION
224
+ static NSString *get_react_native_version()
225
+ {
226
+ // see: https://github.com/facebook/react-native/commit/30469ed00170a74743d2ba5aadce61aae742715c#
227
+ #ifdef RCT_REACT_NATIVE_VERSION
228
+ NSDictionary *vermap = RCT_REACT_NATIVE_VERSION;
229
+ return [NSString stringWithFormat:@"%@.%@.%@",
230
+ vermap[@"major"],
231
+ vermap[@"minor"],
232
+ vermap[@"patch"]];
233
+
234
+ #else
235
+ NSDictionary *vermap = RCTGetReactNativeVersion();
236
+ return [NSString stringWithFormat:@"%@.%@.%@",
237
+ vermap[RCTVersionMajor],
238
+ vermap[RCTVersionMinor],
239
+ vermap[RCTVersionPatch]];
240
+
241
+ #endif
242
+ }
243
+ #endif
244
+
245
+
180
246
  @implementation RPRReproReactBridge
181
247
 
248
+ - (instancetype)init
249
+ {
250
+ self = [super init];
251
+
252
+ if ([Repro respondsToSelector:@selector(_passRuntimeValues:)]) {
253
+ [Repro _passRuntimeValues:@{
254
+ @"sub_sdk_platform": @"react_native",
255
+ #ifndef RPR_CANT_DETERMINE_RN_VERSION
256
+ @"sub_sdk_platform_version": get_react_native_version(),
257
+ #endif
258
+ @"sub_sdk_bridge_version": [NSString stringWithUTF8String:REPRO_REACT_NATIVE_BRIDGE_VERSION],
259
+ }];
260
+ }
261
+
262
+ return self;
263
+ }
264
+
265
+
182
266
  RCT_EXPORT_MODULE(Repro)
183
267
 
184
268
  - (NSDictionary *)constantsToExport
@@ -197,6 +281,12 @@ RCT_EXPORT_MODULE(Repro)
197
281
  @"REMOTE_CONFIG_SUCCESS" : @(RPRRemoteConfigFetchStatusSuccess),
198
282
  @"REMOTE_CONFIG_TIMEOUT_REACHED" : @(RPRRemoteConfigFetchStatusTimeoutReached),
199
283
  @"REMOTE_CONFIG_ALREADY_FETCHED" : @(RPRRemoteConfigFetchStatusAlreadyFetched),
284
+
285
+ @"CAMPAIGN_TYPE_UNKNOWN" : @(RPRCampaignTypeUnknown),
286
+ @"CAMPAIGN_TYPE_PUSH_NOTIFICATION" : @(RPRCampaignTypePushNotification),
287
+ @"CAMPAIGN_TYPE_IN_APP_MESSAGE" : @(RPRCampaignTypeInAppMessage),
288
+ @"CAMPAIGN_TYPE_WEB_MESSAGE" : @(RPRCampaignTypeWebMessage),
289
+ @"CAMPAIGN_TYPE_ALL" : @(RPRCampaignTypeAll),
200
290
  };
201
291
  };
202
292
 
@@ -452,10 +542,24 @@ RCT_EXPORT_METHOD(disableInAppMessagesOnForegroundTransition)
452
542
  [Repro disableInAppMessagesOnForegroundTransition];
453
543
  }
454
544
 
455
- RCT_EXPORT_METHOD(getNewsFeeds:(uint64_t)limit callback:(RCTResponseSenderBlock)callback)
545
+ RCT_EXPORT_METHOD(getNewsFeeds:(uint64_t)limit campaignType:(nonnull NSNumber *)type callback:(RCTResponseSenderBlock)callback)
456
546
  {
457
547
  NSError *error = nil;
458
- NSArray<RPRNewsFeedEntry *> * entries = [Repro getNewsFeeds:limit error:&error];
548
+ RPRCampaignType campaignType = RPRCampaignTypeUnknown;
549
+
550
+ if (type) {
551
+ if ([type isEqualToNumber:@(RPRCampaignTypePushNotification)]) {
552
+ campaignType = RPRCampaignTypePushNotification;
553
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeInAppMessage)]) {
554
+ campaignType = RPRCampaignTypeInAppMessage;
555
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeWebMessage)]) {
556
+ campaignType = RPRCampaignTypeWebMessage;
557
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeAll)]) {
558
+ campaignType = RPRCampaignTypeAll;
559
+ }
560
+ }
561
+
562
+ NSArray<RPRNewsFeedEntry *> * entries = [Repro getNewsFeeds:limit campaignType:campaignType error:&error];
459
563
 
460
564
  if (error) {
461
565
  NSString *errString = [error localizedDescription];
@@ -481,11 +585,12 @@ RCT_EXPORT_METHOD(getNewsFeeds:(uint64_t)limit callback:(RCTResponseSenderBlock)
481
585
  @"title": entry.title,
482
586
  @"summary": entry.summary,
483
587
  @"body": entry.body,
588
+ @"campaign_type": @(entry.campaignType),
484
589
  @"shown": @(entry.shown),
485
590
  @"read": @(entry.read),
486
591
  @"delivered_at": formattedDateString,
487
592
  @"link_url": entry.linkUrl ? [entry.linkUrl absoluteString] : @"",
488
- @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @""
593
+ @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @"",
489
594
  };
490
595
 
491
596
  [entryJsons addObject:entryJson];
@@ -494,10 +599,24 @@ RCT_EXPORT_METHOD(getNewsFeeds:(uint64_t)limit callback:(RCTResponseSenderBlock)
494
599
  callback(@[[NSNull null], safe_value(entryJsons)]);
495
600
  }
496
601
 
497
- RCT_EXPORT_METHOD(getNewsFeedsFor:(uint64_t)limit offsetID:(uint64_t)offsetID callback:(RCTResponseSenderBlock)callback)
602
+ RCT_EXPORT_METHOD(getNewsFeedsFor:(uint64_t)limit offsetID:(uint64_t)offsetID campaignType:(nonnull NSNumber *)type callback:(RCTResponseSenderBlock)callback)
498
603
  {
499
604
  NSError *error = nil;
500
- NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:limit offsetID:offsetID error:&error];
605
+ RPRCampaignType campaignType = RPRCampaignTypeUnknown;
606
+
607
+ if (type) {
608
+ if ([type isEqualToNumber:@(RPRCampaignTypePushNotification)]) {
609
+ campaignType = RPRCampaignTypePushNotification;
610
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeInAppMessage)]) {
611
+ campaignType = RPRCampaignTypeInAppMessage;
612
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeWebMessage)]) {
613
+ campaignType = RPRCampaignTypeWebMessage;
614
+ } else if ([type isEqualToNumber:@(RPRCampaignTypeAll)]) {
615
+ campaignType = RPRCampaignTypeAll;
616
+ }
617
+ }
618
+
619
+ NSArray<RPRNewsFeedEntry *> *entries = [Repro getNewsFeeds:limit offsetID:offsetID campaignType:campaignType error:&error];
501
620
 
502
621
  if (error) {
503
622
  NSString *errString = [error localizedDescription];
@@ -523,11 +642,12 @@ RCT_EXPORT_METHOD(getNewsFeedsFor:(uint64_t)limit offsetID:(uint64_t)offsetID ca
523
642
  @"title": entry.title,
524
643
  @"summary": entry.summary,
525
644
  @"body": entry.body,
645
+ @"campaign_type": @(entry.campaignType),
526
646
  @"shown": @(entry.shown),
527
647
  @"read": @(entry.read),
528
648
  @"delivered_at": formattedDateString,
529
649
  @"link_url": entry.linkUrl ? [entry.linkUrl absoluteString] : @"",
530
- @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @""
650
+ @"image_url": entry.imageUrl ? [entry.imageUrl absoluteString] : @"",
531
651
  };
532
652
 
533
653
  [entryJsons addObject:entryJson];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-repro",
3
- "version": "3.6.0",
4
- "description": "Repro is a mobile analytics tool that lets you have much deeper understanding of mobile app users with play-by-play videos.",
3
+ "version": "3.9.0",
4
+ "description": "Repro is a mobile analytics tool that lets you have much deeper understanding of mobile app users.",
5
5
  "main": "index.js",
6
6
  "keywords": [
7
7
  "repro",
@@ -1,5 +1,5 @@
1
1
  {
2
- "ios-sdk": "5.7.0",
3
- "android-sdk": "5.5.1",
4
- "bridge": "3.6.0"
2
+ "ios-sdk": "5.8.3",
3
+ "android-sdk": "5.6.3",
4
+ "bridge": "3.9.0"
5
5
  }
@@ -0,0 +1 @@
1
+ 83b1e3e6478196a9b5de07ed402461c4
@@ -0,0 +1 @@
1
+ 8c84ee19f1ceba57f18016b716b9b1e5163d9697
@@ -4,6 +4,6 @@
4
4
  <modelVersion>4.0.0</modelVersion>
5
5
  <groupId>io.repro</groupId>
6
6
  <artifactId>repro-android-sdk</artifactId>
7
- <version>5.5.1</version>
7
+ <version>5.6.3</version>
8
8
  <packaging>aar</packaging>
9
9
  </project>
@@ -0,0 +1 @@
1
+ ebbd73d813575a6838a15e006ccf7553
@@ -0,0 +1 @@
1
+ 1c5eb358e76899c315a6b750d4bc86f3cd5a874e
@@ -3,10 +3,10 @@
3
3
  <groupId>io.repro</groupId>
4
4
  <artifactId>repro-android-sdk</artifactId>
5
5
  <versioning>
6
- <release>5.5.1</release>
6
+ <release>5.6.3</release>
7
7
  <versions>
8
- <version>5.5.1</version>
8
+ <version>5.6.3</version>
9
9
  </versions>
10
- <lastUpdated>20211015085736</lastUpdated>
10
+ <lastUpdated>20220608194718</lastUpdated>
11
11
  </versioning>
12
12
  </metadata>
@@ -1 +1 @@
1
- d2d0379ca8e867ea3d1fd94ab0c5b767
1
+ f0a2977b387f3e030fbee96cff0aa308
@@ -1 +1 @@
1
- e11aa13250c194bbdf29a75f1660cb144372b52d
1
+ 120afe267300aef6c8165b57c63143579ae431c0
@@ -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
 
@@ -1 +0,0 @@
1
- eaf8eff60f355a6f4e4d662f6f25e292
@@ -1 +0,0 @@
1
- 6e27a0567367e9e0687a5cf0ebb3f4719357b904
@@ -1 +0,0 @@
1
- a4ec51d6719ac6f1c0a43cdf183f21cb
@@ -1 +0,0 @@
1
- 6cb1f80c4db1e63fc067dc1cca7c4f201748d2cf