Skip to content

Commit 2af7d22

Browse files
feat: Add shouldUploadEvent option for Android and iOS
1 parent 9976173 commit 2af7d22

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

android/src/main/java/com/mparticle/react/MParticleModule.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ private static MPEvent ConvertMPEvent(ReadableMap map) {
508508
}
509509
}
510510

511+
if (map.hasKey("shouldUploadEvent")) {
512+
builder.shouldUploadEvent(map.getBoolean("shouldUploadEvent"));
513+
}
514+
511515
return builder.build();
512516
}
513517

@@ -588,6 +592,10 @@ else if (isPromotion) {
588592
}
589593
}
590594

595+
if (map.hasKey("shouldUploadEvent")) {
596+
builder.shouldUploadEvent(map.getBoolean("shouldUploadEvent"));
597+
}
598+
591599
return builder.build();
592600
}
593601

ios/RNMParticle/RNMParticle.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ + (MPCommerceEvent *)MPCommerceEvent:(id)json {
416416
commerceEvent.action = [RCTConvert MPCommerceEventAction:json[@"productActionType"]];
417417
commerceEvent.checkoutStep = [json[@"checkoutStep"] intValue];
418418
commerceEvent.nonInteractive = [json[@"nonInteractive"] boolValue];
419+
if json[@"shouldUploadEvent"] != nil {
420+
event.shouldUploadEvent = [json[@"shouldUploadEvent"] boolValue]
421+
}
419422

420423
NSMutableArray *products = [NSMutableArray array];
421424
NSArray *jsonProducts = json[@"products"];
@@ -602,6 +605,9 @@ + (MPEvent *)MPEvent:(id)json {
602605
event.name = json[@"name"];
603606
event.startTime = json[@"startTime"];
604607
event.type = [json[@"type"] intValue];
608+
if json[@"shouldUploadEvent"] != nil {
609+
event.shouldUploadEvent = [json[@"shouldUploadEvent"] boolValue]
610+
}
605611

606612
NSDictionary *jsonFlags = json[@"customFlags"];
607613
for (NSString *key in jsonFlags) {

js/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,11 @@ class CommerceEvent {
566566
this.nonInteractive = nonInteractive
567567
return this
568568
}
569+
570+
setShouldUploadEvent (shouldUploadEvent) {
571+
this.shouldUploadEvent = shouldUploadEvent
572+
return this
573+
}
569574
}
570575

571576
class Event {
@@ -605,6 +610,11 @@ class Event {
605610
return this
606611
}
607612

613+
setShouldUploadEvent (shouldUploadEvent) {
614+
this.shouldUploadEvent = shouldUploadEvent
615+
return this
616+
}
617+
608618
setCustomFlags (customFlags) {
609619
this.customFlags = customFlags
610620
return this

0 commit comments

Comments
 (0)