Skip to content

Commit 8cb4ee6

Browse files
committed
make setInvocationEvent threadsafe
1 parent 3dde3a7 commit 8cb4ee6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -807,12 +807,17 @@ public void getUnreadMessagesCount(Callback messageCountCallback) {
807807
* @see InstabugInvocationEvent
808808
*/
809809
@ReactMethod
810-
public void setInvocationEvent(String invocationEventValue) {
811-
try {
812-
BugReporting.setInvocationEvents(getInvocationEventById(invocationEventValue));
813-
} catch (Exception e) {
814-
e.printStackTrace();
815-
}
810+
public void setInvocationEvent(final String invocationEventValue) {
811+
new Handler(Looper.getMainLooper()).post(new Runnable() {
812+
@Override
813+
public void run() {
814+
try {
815+
BugReporting.setInvocationEvents(getInvocationEventById(invocationEventValue));
816+
} catch (Exception e) {
817+
e.printStackTrace();
818+
}
819+
}
820+
});
816821
}
817822

818823
/**

0 commit comments

Comments
 (0)