1010import com .instabug .library .Instabug ;
1111import com .instabug .library .InstabugColorTheme ;
1212import com .instabug .library .invocation .InstabugInvocationEvent ;
13+ import android .graphics .Color ;
1314
1415import java .util .ArrayList ;
1516import java .util .Collections ;
@@ -24,11 +25,37 @@ public class RNInstabugReactnativePackage implements ReactPackage {
2425 private InstabugInvocationEvent invocationEvent = InstabugInvocationEvent .FLOATING_BUTTON ;
2526 private InstabugColorTheme instabugColorTheme = InstabugColorTheme .InstabugColorThemeLight ;
2627
27- public RNInstabugReactnativePackage (String androidApplicationToken , Application androidApplication ) {
28+ public RNInstabugReactnativePackage (String androidApplicationToken , Application androidApplication ,
29+ String invocationEventValue , String primaryColor ) {
2830 this .androidApplication = androidApplication ;
2931 this .mAndroidApplicationToken = androidApplicationToken ;
32+
33+ //setting invocation event
34+ if (invocationEventValue .equals ("button" )) {
35+ this .invocationEvent = InstabugInvocationEvent .FLOATING_BUTTON ;
36+ } else if (invocationEventValue .equals ("swipe" )) {
37+ this .invocationEvent = InstabugInvocationEvent .TWO_FINGER_SWIPE_LEFT ;
38+
39+ } else if (invocationEventValue .equals ("shake" )) {
40+ this .invocationEvent = InstabugInvocationEvent .SHAKE ;
41+
42+ } else if (invocationEventValue .equals ("screenshot" )) {
43+ this .invocationEvent = InstabugInvocationEvent .SCREENSHOT_GESTURE ;
44+
45+ } else if (invocationEventValue .equals ("none" )) {
46+ this .invocationEvent = InstabugInvocationEvent .NONE ;
47+
48+ } else {
49+ this .invocationEvent = InstabugInvocationEvent .SHAKE ;
50+ }
51+
52+
3053 mInstabug = new Instabug .Builder (this .androidApplication , this .mAndroidApplicationToken )
54+ .setInvocationEvent (this .invocationEvent )
3155 .build ();
56+
57+ Instabug .setPrimaryColor (Color .parseColor (primaryColor ));
58+
3259 }
3360
3461 @ Deprecated
0 commit comments