3333import com .instabug .reactlibrary .utils .MapUtil ;
3434
3535import java .util .ArrayList ;
36+ import java .util .Arrays ;
3637import java .util .HashMap ;
3738import java .util .Locale ;
3839import java .util .Map ;
@@ -212,10 +213,11 @@ public void dismiss() {
212213 * @param tags
213214 */
214215 @ ReactMethod
215- public void appendTags (String tags ) {
216+ public void appendTags (ReadableArray tags ) {
216217 try {
217- String [] result = tags .split ("," );
218- mInstabug .addTags (result );
218+ Object [] objectArray = ArrayUtil .toArray (tags );
219+ String [] stringArray = Arrays .copyOf (objectArray , objectArray .length , String [].class );
220+ mInstabug .addTags (stringArray );
219221 } catch (Exception e ) {
220222 e .printStackTrace ();
221223 }
@@ -909,7 +911,7 @@ public void setPreInvocationHandler(final Callback preInvocationHandler) {
909911 Runnable preInvocationRunnable = new Runnable () {
910912 @ Override
911913 public void run () {
912- preInvocationHandler . invoke ( );
914+ sendEvent ( getReactApplicationContext (), "IBGpreInvocationHandler" , null );
913915 }
914916 };
915917 mInstabug .setPreInvocation (preInvocationRunnable );
@@ -933,7 +935,7 @@ public void setPreSendingHandler(final Callback preSendingHandler) {
933935 Runnable preSendingRunnable = new Runnable () {
934936 @ Override
935937 public void run () {
936- preSendingHandler . invoke ( );
938+ sendEvent ( getReactApplicationContext (), "IBGpreSendingHandler" , null );
937939 }
938940 };
939941 mInstabug .setPreSendingRunnable (preSendingRunnable );
@@ -957,7 +959,10 @@ public void setPostInvocationHandler(final Callback postInvocationHandler) {
957959 mInstabug .setOnSdkDismissedCallback (new OnSdkDismissedCallback () {
958960 @ Override
959961 public void onSdkDismissed (DismissType issueState , Bug .Type bugType ) {
960- postInvocationHandler .invoke ();
962+ WritableMap params = Arguments .createMap ();
963+ params .putString ("issueState" , issueState .toString ());
964+ params .putString ("bugType" , bugType .toString ());
965+ sendEvent (getReactApplicationContext (), "IBGpostInvocationHandler" , params );
961966 }
962967 });
963968
@@ -1022,7 +1027,7 @@ public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) {
10221027 Runnable willShowSurveyRunnable = new Runnable () {
10231028 @ Override
10241029 public void run () {
1025- willShowSurveyHandler . invoke ( );
1030+ sendEvent ( getReactApplicationContext (), "IBGWillShowSurvey" , null );
10261031 }
10271032 };
10281033 mInstabug .setPreShowingSurveyRunnable (willShowSurveyRunnable );
@@ -1044,7 +1049,7 @@ public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) {
10441049 Runnable didDismissSurveyRunnable = new Runnable () {
10451050 @ Override
10461051 public void run () {
1047- didDismissSurveyHandler . invoke ( );
1052+ sendEvent ( getReactApplicationContext (), "IBGDidDismissSurvey" , null );
10481053 }
10491054 };
10501055 mInstabug .setAfterShowingSurveyRunnable (didDismissSurveyRunnable );
@@ -1115,7 +1120,7 @@ public void setOnNewMessageHandler(final Callback onNewMessageHandler) {
11151120 Runnable onNewMessageRunnable = new Runnable () {
11161121 @ Override
11171122 public void run () {
1118- onNewMessageHandler . invoke ( );
1123+ sendEvent ( getReactApplicationContext (), "IBGonNewMessageHandler" , null );
11191124 }
11201125 };
11211126 mInstabug .setNewMessageHandler (onNewMessageRunnable );
0 commit comments