Skip to content

Commit 30bd01e

Browse files
Enable switching between InstabugInvocationEvents
Enable setting Primary color to Instabug
1 parent 9b871df commit 30bd01e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.instabug.library.Instabug;
1111
import com.instabug.library.InstabugColorTheme;
1212
import com.instabug.library.invocation.InstabugInvocationEvent;
13+
import android.graphics.Color;
1314

1415
import java.util.ArrayList;
1516
import 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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"homepage": "https://github.com/Instabug/instabug-reactnative#readme",
2424
"rnpm": {
2525
"android": {
26-
"packageInstance": "new RNInstabugReactnativePackage(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this)"
26+
"packageInstance": "new RNInstabugReactnativePackage(\"YOUR_ANDROID_APPLICATION_TOKEN\",MainApplication.this,\"shake\",\"#1D82DC\")"
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)