33
33
import com .instabug .reactlibrary .utils .MapUtil ;
34
34
35
35
import java .util .ArrayList ;
36
+ import java .util .Arrays ;
36
37
import java .util .HashMap ;
37
38
import java .util .Locale ;
38
39
import java .util .Map ;
@@ -212,10 +213,11 @@ public void dismiss() {
212
213
* @param tags
213
214
*/
214
215
@ ReactMethod
215
- public void appendTags (String tags ) {
216
+ public void appendTags (ReadableArray tags ) {
216
217
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 );
219
221
} catch (Exception e ) {
220
222
e .printStackTrace ();
221
223
}
@@ -909,7 +911,7 @@ public void setPreInvocationHandler(final Callback preInvocationHandler) {
909
911
Runnable preInvocationRunnable = new Runnable () {
910
912
@ Override
911
913
public void run () {
912
- preInvocationHandler . invoke ( );
914
+ sendEvent ( getReactApplicationContext (), "IBGpreInvocationHandler" , null );
913
915
}
914
916
};
915
917
mInstabug .setPreInvocation (preInvocationRunnable );
@@ -933,7 +935,7 @@ public void setPreSendingHandler(final Callback preSendingHandler) {
933
935
Runnable preSendingRunnable = new Runnable () {
934
936
@ Override
935
937
public void run () {
936
- preSendingHandler . invoke ( );
938
+ sendEvent ( getReactApplicationContext (), "IBGpreSendingHandler" , null );
937
939
}
938
940
};
939
941
mInstabug .setPreSendingRunnable (preSendingRunnable );
@@ -957,7 +959,10 @@ public void setPostInvocationHandler(final Callback postInvocationHandler) {
957
959
mInstabug .setOnSdkDismissedCallback (new OnSdkDismissedCallback () {
958
960
@ Override
959
961
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 );
961
966
}
962
967
});
963
968
@@ -1022,7 +1027,7 @@ public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) {
1022
1027
Runnable willShowSurveyRunnable = new Runnable () {
1023
1028
@ Override
1024
1029
public void run () {
1025
- willShowSurveyHandler . invoke ( );
1030
+ sendEvent ( getReactApplicationContext (), "IBGWillShowSurvey" , null );
1026
1031
}
1027
1032
};
1028
1033
mInstabug .setPreShowingSurveyRunnable (willShowSurveyRunnable );
@@ -1044,7 +1049,7 @@ public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) {
1044
1049
Runnable didDismissSurveyRunnable = new Runnable () {
1045
1050
@ Override
1046
1051
public void run () {
1047
- didDismissSurveyHandler . invoke ( );
1052
+ sendEvent ( getReactApplicationContext (), "IBGDidDismissSurvey" , null );
1048
1053
}
1049
1054
};
1050
1055
mInstabug .setAfterShowingSurveyRunnable (didDismissSurveyRunnable );
@@ -1115,7 +1120,7 @@ public void setOnNewMessageHandler(final Callback onNewMessageHandler) {
1115
1120
Runnable onNewMessageRunnable = new Runnable () {
1116
1121
@ Override
1117
1122
public void run () {
1118
- onNewMessageHandler . invoke ( );
1123
+ sendEvent ( getReactApplicationContext (), "IBGonNewMessageHandler" , null );
1119
1124
}
1120
1125
};
1121
1126
mInstabug .setNewMessageHandler (onNewMessageRunnable );
0 commit comments