From 8cb4ee6fb19b683add66b80f760949b75b2864b0 Mon Sep 17 00:00:00 2001 From: cpetzel Date: Fri, 2 Nov 2018 16:47:23 -0700 Subject: [PATCH] make setInvocationEvent threadsafe --- .../RNInstabugReactnativeModule.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 49dc79428..10a60d7c2 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -807,12 +807,17 @@ public void getUnreadMessagesCount(Callback messageCountCallback) { * @see InstabugInvocationEvent */ @ReactMethod - public void setInvocationEvent(String invocationEventValue) { - try { - BugReporting.setInvocationEvents(getInvocationEventById(invocationEventValue)); - } catch (Exception e) { - e.printStackTrace(); - } + public void setInvocationEvent(final String invocationEventValue) { + new Handler(Looper.getMainLooper()).post(new Runnable() { + @Override + public void run() { + try { + BugReporting.setInvocationEvents(getInvocationEventById(invocationEventValue)); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); } /**