Skip to content

Commit 68f4ec4

Browse files
committed
✨ setReproStepsMode API for Android and iOS
1 parent 7470f78 commit 68f4ec4

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.instabug.library.user.UserEventParam;
3434
import com.instabug.library.OnSdkDismissedCallback;
3535
import com.instabug.library.bugreporting.model.Bug;
36+
import com.instabug.library.visualusersteps.State;
3637
import com.instabug.survey.InstabugSurvey;
3738

3839
import com.instabug.reactlibrary.utils.ArrayUtil;
@@ -93,6 +94,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
9394
private final String EXTENDED_BUG_REPORT_OPTIONAL_FIELDS = "enabledWithOptionalFields";
9495
private final String EXTENDED_BUG_REPORT_DISABLED = "disabled";
9596

97+
//Instabug repro step modes
98+
private final String ENABLED_WITH_NO_SCREENSHOT = "enabledWithNoScreenshot";
99+
private final String ENABLED = "enabled";
100+
private final String DISABLED = "disabled";
101+
96102
//Theme colors
97103
private final String COLOR_THEME_LIGHT = "light";
98104
private final String COLOR_THEME_DARK = "dark";
@@ -1226,6 +1232,34 @@ public void clearFileAttachment() {
12261232
}
12271233
}
12281234

1235+
/**
1236+
* Sets whether user steps tracking is visual, non visula or disabled.
1237+
*
1238+
* @param reproStepsMode A string to set user steps tracking to be
1239+
* enabled, non visual or disabled.
1240+
*/
1241+
@ReactMethod
1242+
public void setReproStepsMode(String reproStepsMode) {
1243+
try {
1244+
switch(reproStepsMode) {
1245+
case ENABLED_WITH_NO_SCREENSHOT:
1246+
Instabug.setReproStepsState(State.ENABLED_WITH_NO_SCREENSHOTS);
1247+
break;
1248+
case ENABLED:
1249+
Instabug.setReproStepsState(State.ENABLED);
1250+
break;
1251+
case DISABLED:
1252+
Instabug.setReproStepsState(State.DISABLED);
1253+
break;
1254+
default:
1255+
Instabug.setReproStepsState(State.ENABLED);
1256+
}
1257+
1258+
} catch (Exception e) {
1259+
e.printStackTrace();
1260+
}
1261+
}
1262+
12291263
/**
12301264
* Sets the threshold value of the shake gesture for android devices.
12311265
* Default for android is an integer value equals 350.
@@ -1474,6 +1508,10 @@ public Map<String, Object> getConstants() {
14741508
constants.put("enabledWithOptionalFields", EXTENDED_BUG_REPORT_OPTIONAL_FIELDS);
14751509
constants.put("disabled", EXTENDED_BUG_REPORT_DISABLED);
14761510

1511+
constants.put("reproStepsEnabledWithNoScreenshot", ENABLED_WITH_NO_SCREENSHOT);
1512+
constants.put("reproStepsEnabled", ENABLED);
1513+
constants.put("reproStepsDisabled", DISABLED);
1514+
14771515
constants.put("shakeHint", SHAKE_HINT);
14781516
constants.put("swipeHint", SWIPE_HINT);
14791517
constants.put("invalidEmailMessage", INVALID_EMAIL_MESSAGE);

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,16 @@ module.exports = {
670670
}
671671
},
672672

673+
/**
674+
* Sets whether user steps tracking is visual, non visula or disabled.
675+
*
676+
* @param {reproStepsMode} reproStepsMode An enum to set user steps tracking to be
677+
* enabled, non visual or disabled.
678+
*/
679+
setReproStepsMode: function (reproStepsMode) {
680+
Instabug.setReproStepsMode(reproStepsMode);
681+
},
682+
673683
/**
674684
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
675685
*

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ - (NSDictionary *)constantsToExport
405405
@"dismissTypeAddAtttachment": @(IBGDismissTypeAddAttachment),
406406

407407
@"reproStepsEnabled": @(IBGUserStepsModeEnable),
408-
@"reproStepsDisabled": @(IBGUserStepsModeEnabledWithNoScreenshots),
409-
@"reproStepsEnabledWithNoScreenshot": @(IBGUserStepsModeDisable),
408+
@"reproStepsDisabled": @(IBGUserStepsModeDisable),
409+
@"reproStepsEnabledWithNoScreenshot": @(IBGUserStepsModeEnabledWithNoScreenshots),
410410

411411
@"reportTypeBug": @(IBGReportTypeBug),
412412
@"reportTypeFeedback": @(IBGReportTypeFeedback),

0 commit comments

Comments
 (0)