Skip to content

Commit b009e16

Browse files
Enable logUserEventWithName API for android
1 parent 81e5955 commit b009e16

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,21 @@ public void setWillSkipScreenshotAnnotation(boolean willSkipScreenshotAnnotation
830830
}
831831
}
832832

833+
/**
834+
* Logs a user event that happens through the lifecycle of the application.
835+
* Logged user events are going to be sent with each report, as well as at the end of a session.
836+
*
837+
* @param {string} name Event name.
838+
*/
839+
@ReactMethod
840+
public void logUserEventWithName(String name) {
841+
try {
842+
mInstabug.logUserEvent(name);
843+
} catch (java.lang.Exception exception) {
844+
exception.printStackTrace();
845+
}
846+
}
847+
833848
private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
834849
String keyInLowerCase = key.toLowerCase();
835850
switch (keyInLowerCase) {

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,7 @@ module.exports = {
460460
* @param {string} name Event name.
461461
*/
462462
logUserEventWithName: function (name) {
463-
if (Platform.OS == 'ios') {
464-
Instabug.logUserEventWithName(name);
465-
}
463+
Instabug.logUserEventWithName(name);
466464
},
467465

468466
/**
@@ -472,9 +470,7 @@ module.exports = {
472470
* @param {Object} params An optional dictionary or parameters to be associated with the event.
473471
*/
474472
logUserEventWithNameAndParams: function (name, params) {
475-
if (Platform.OS == 'ios') {
476-
Instabug.logUserEventWithNameAndParams(name, params);
477-
}
473+
Instabug.logUserEventWithNameAndParams(name, params);
478474
},
479475

480476
/**

0 commit comments

Comments
 (0)