Skip to content

Commit e4ea2cc

Browse files
feat: Allow uploadInterval to be set manually (#95)
1 parent ff86ee6 commit e4ea2cc

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public void upload() {
6868
MParticle.getInstance().upload();
6969
}
7070

71+
@ReactMethod
72+
public void setUploadInterval(int uploadInterval) {
73+
MParticle.getInstance().setUpdateInterval(uploadInterval);
74+
}
75+
7176
@ReactMethod
7277
public void logEvent(final String name, int type, final ReadableMap attributesMap) {
7378
Map<String, String> attributes = ConvertStringMap(attributesMap);

ios/RNMParticle/RNMParticle.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ + (void)load {
2424
[[MParticle sharedInstance] upload];
2525
}
2626

27+
RCT_EXPORT_METHOD(setUploadInterval:(NSInteger)uploadInterval)
28+
{
29+
[[MParticle sharedInstance] setUploadInterval:uploadInterval];
30+
}
31+
2732
RCT_EXPORT_METHOD(logEvent:(NSString *)eventName type:(NSInteger)type attributes:(NSDictionary *)attributes)
2833
{
2934
[[MParticle sharedInstance] logEvent:eventName eventType:type eventInfo:attributes];

js/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ const upload = () => {
8888
NativeModules.MParticle.upload()
8989
}
9090

91+
const setUploadInterval = (uploadInterval) => {
92+
NativeModules.MParticle.setUploadInterval(uploadInterval)
93+
}
94+
9195
const logEvent = (eventName, type = EventType.Other, attributes = null) => {
9296
NativeModules.MParticle.logEvent(eventName, type, attributes)
9397
}
@@ -664,8 +668,9 @@ const MParticle = {
664668
GDPRConsent,
665669
CCPAConsent,
666670

667-
upload,
668-
logEvent, // Methods
671+
upload, // Methods
672+
setUploadInterval,
673+
logEvent,
669674
logMPEvent,
670675
logCommerceEvent,
671676
logScreenEvent,

0 commit comments

Comments
 (0)