File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed
android/src/main/java/com/instabug/reactlibrary Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -617,12 +617,17 @@ public void showIntroMessage() {
617617 * or RGB color values
618618 */
619619 @ ReactMethod
620- public void setPrimaryColor (int primaryColor ) {
621- try {
622- mInstabug .setPrimaryColor (primaryColor );
623- } catch (Exception e ) {
624- e .printStackTrace ();
625- }
620+ public void setPrimaryColor (final int primaryColor ) {
621+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
622+ @ Override
623+ public void run () {
624+ try {
625+ mInstabug .setPrimaryColor (primaryColor );
626+ } catch (Exception e ) {
627+ e .printStackTrace ();
628+ }
629+ }
630+ });
626631 }
627632
628633 /**
@@ -831,7 +836,7 @@ public void setInvocationEvents(ReadableArray invocationEventValues) {
831836 try {
832837 Object [] objectArray = ArrayUtil .toArray (invocationEventValues );
833838 String [] stringArray = Arrays .copyOf (objectArray , objectArray .length , String [].class );
834- ArrayList <InstabugInvocationEvent > parsedInvocationEvents = new ArrayList <>();
839+ final ArrayList <InstabugInvocationEvent > parsedInvocationEvents = new ArrayList <>();
835840
836841 Log .d (TAG , Arrays .toString (stringArray ) + " " + INVOCATION_EVENT_FLOATING_BUTTON );
837842
@@ -857,7 +862,16 @@ public void setInvocationEvents(ReadableArray invocationEventValues) {
857862 break ;
858863 }
859864 }
860- BugReporting .setInvocationEvents (parsedInvocationEvents .toArray (new InstabugInvocationEvent [0 ]));
865+ new Handler (Looper .getMainLooper ()).post (new Runnable () {
866+ @ Override
867+ public void run () {
868+ try {
869+ BugReporting .setInvocationEvents (parsedInvocationEvents .toArray (new InstabugInvocationEvent [0 ]));
870+ } catch (Exception e ) {
871+ e .printStackTrace ();
872+ }
873+ }
874+ });
861875 } catch (Exception e ) {
862876 e .printStackTrace ();
863877 }
You can’t perform that action at this time.
0 commit comments