|
21 | 21 | import com.facebook.react.modules.core.DeviceEventManagerModule;
|
22 | 22 | import com.instabug.library.Feature;
|
23 | 23 | import com.instabug.library.Instabug;
|
| 24 | +import com.instabug.library.extendedbugreport.ExtendedBugReport; |
24 | 25 | import com.instabug.library.internal.module.InstabugLocale;
|
25 | 26 | import com.instabug.library.invocation.InstabugInvocationEvent;
|
26 | 27 | import com.instabug.library.invocation.InstabugInvocationMode;
|
@@ -87,6 +88,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
87 | 88 | private final String BOTTOM_RIGHT = "bottomRight";
|
88 | 89 | private final String BOTTOM_LEFT = "bottomLeft";
|
89 | 90 |
|
| 91 | + //Instabug extended bug report modes |
| 92 | + private final String EXTENDED_BUG_REPORT_REQUIRED_FIELDS = "enabledWithRequiredFields"; |
| 93 | + private final String EXTENDED_BUG_REPORT_OPTIONAL_FIELDS = "enabledWithOptionalFields"; |
| 94 | + private final String EXTENDED_BUG_REPORT_DISABLED = "disabled"; |
| 95 | + |
90 | 96 | //Theme colors
|
91 | 97 | private final String COLOR_THEME_LIGHT = "light";
|
92 | 98 | private final String COLOR_THEME_DARK = "dark";
|
@@ -205,6 +211,8 @@ public void invokeWithInvocationMode(String invocationMode) {
|
205 | 211 | }
|
206 | 212 |
|
207 | 213 |
|
| 214 | + |
| 215 | + |
208 | 216 | /**
|
209 | 217 | * Dismisses all visible Instabug views
|
210 | 218 | */
|
@@ -279,6 +287,33 @@ public void changeLocale(String instabugLocale) {
|
279 | 287 | }
|
280 | 288 | }
|
281 | 289 |
|
| 290 | + /** |
| 291 | + * Sets whether the extended bug report mode should be disabled, |
| 292 | + * enabled with required fields, or enabled with optional fields. |
| 293 | + * |
| 294 | + * @param extendedBugReportMode |
| 295 | + */ |
| 296 | + @ReactMethod |
| 297 | + public void setExtendedBugReportMode(String extendedBugReportMode) { |
| 298 | + try { |
| 299 | + switch(extendedBugReportMode) { |
| 300 | + case EXTENDED_BUG_REPORT_REQUIRED_FIELDS: |
| 301 | + Instabug.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_REQUIRED_FIELDS); |
| 302 | + break; |
| 303 | + case EXTENDED_BUG_REPORT_OPTIONAL_FIELDS: |
| 304 | + Instabug.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_OPTIONAL_FIELDS); |
| 305 | + break; |
| 306 | + case EXTENDED_BUG_REPORT_DISABLED: |
| 307 | + Instabug.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); |
| 308 | + break; |
| 309 | + default: |
| 310 | + Instabug.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); |
| 311 | + } |
| 312 | + } catch (Exception e) { |
| 313 | + e.printStackTrace(); |
| 314 | + } |
| 315 | + } |
| 316 | + |
282 | 317 | @ReactMethod
|
283 | 318 | public void setViewHierarchyEnabled(boolean enabled) {
|
284 | 319 | try {
|
@@ -1435,6 +1470,10 @@ public Map<String, Object> getConstants() {
|
1435 | 1470 | constants.put("bottomRight", BOTTOM_RIGHT);
|
1436 | 1471 | constants.put("bottomLeft", BOTTOM_LEFT);
|
1437 | 1472 |
|
| 1473 | + constants.put("enabledWithRequiredFields", EXTENDED_BUG_REPORT_REQUIRED_FIELDS); |
| 1474 | + constants.put("enabledWithOptionalFields", EXTENDED_BUG_REPORT_OPTIONAL_FIELDS); |
| 1475 | + constants.put("disabled", EXTENDED_BUG_REPORT_DISABLED); |
| 1476 | + |
1438 | 1477 | constants.put("shakeHint", SHAKE_HINT);
|
1439 | 1478 | constants.put("swipeHint", SWIPE_HINT);
|
1440 | 1479 | constants.put("invalidEmailMessage", INVALID_EMAIL_MESSAGE);
|
|
0 commit comments