Skip to content

Commit 1a4e56f

Browse files
feat: Add Manual Upload (#86)
1 parent 47589ce commit 1a4e56f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
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
@@ -62,6 +62,11 @@ public String getName() {
6262
return "MParticle";
6363
}
6464

65+
@ReactMethod
66+
public void upload() {
67+
MParticle.getInstance().upload();
68+
}
69+
6570
@ReactMethod
6671
public void logEvent(final String name, int type, final ReadableMap attributesMap) {
6772
Map<String, String> attributes = ConvertStringMap(attributesMap);

ios/RNMParticle/RNMParticle.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ + (void)load {
1919
RCTRegisterModule(self);
2020
}
2121

22+
RCT_EXPORT_METHOD(upload)
23+
{
24+
[[MParticle sharedInstance] upload];
25+
}
26+
2227
RCT_EXPORT_METHOD(logEvent:(NSString *)eventName type:(NSInteger)type attributes:(NSDictionary *)attributes)
2328
{
2429
[[MParticle sharedInstance] logEvent:eventName eventType:type eventInfo:attributes];

js/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ const ATTAuthStatus = {
8484

8585
// ******** Main API ********
8686

87+
const upload = () => {
88+
NativeModules.MParticle.upload()
89+
}
90+
8791
const logEvent = (eventName, type = EventType.Other, attributes = null) => {
8892
NativeModules.MParticle.logEvent(eventName, type, attributes)
8993
}
@@ -660,6 +664,7 @@ const MParticle = {
660664
GDPRConsent,
661665
CCPAConsent,
662666

667+
upload,
663668
logEvent, // Methods
664669
logMPEvent,
665670
logCommerceEvent,

0 commit comments

Comments
 (0)