setReproStepsMode API for Android and iOS

This commit is contained in:
Salma ElTarzi 2018-03-05 15:54:48 +02:00
parent 7470f78092
commit 68f4ec41cc
3 changed files with 50 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import com.instabug.library.InstabugCustomTextPlaceHolder;
import com.instabug.library.user.UserEventParam;
import com.instabug.library.OnSdkDismissedCallback;
import com.instabug.library.bugreporting.model.Bug;
import com.instabug.library.visualusersteps.State;
import com.instabug.survey.InstabugSurvey;
import com.instabug.reactlibrary.utils.ArrayUtil;
@ -93,6 +94,11 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
private final String EXTENDED_BUG_REPORT_OPTIONAL_FIELDS = "enabledWithOptionalFields";
private final String EXTENDED_BUG_REPORT_DISABLED = "disabled";
//Instabug repro step modes
private final String ENABLED_WITH_NO_SCREENSHOT = "enabledWithNoScreenshot";
private final String ENABLED = "enabled";
private final String DISABLED = "disabled";
//Theme colors
private final String COLOR_THEME_LIGHT = "light";
private final String COLOR_THEME_DARK = "dark";
@ -1226,6 +1232,34 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Sets whether user steps tracking is visual, non visula or disabled.
*
* @param reproStepsMode A string to set user steps tracking to be
* enabled, non visual or disabled.
*/
@ReactMethod
public void setReproStepsMode(String reproStepsMode) {
try {
switch(reproStepsMode) {
case ENABLED_WITH_NO_SCREENSHOT:
Instabug.setReproStepsState(State.ENABLED_WITH_NO_SCREENSHOTS);
break;
case ENABLED:
Instabug.setReproStepsState(State.ENABLED);
break;
case DISABLED:
Instabug.setReproStepsState(State.DISABLED);
break;
default:
Instabug.setReproStepsState(State.ENABLED);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Sets the threshold value of the shake gesture for android devices.
* Default for android is an integer value equals 350.
@ -1474,6 +1508,10 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
constants.put("enabledWithOptionalFields", EXTENDED_BUG_REPORT_OPTIONAL_FIELDS);
constants.put("disabled", EXTENDED_BUG_REPORT_DISABLED);
constants.put("reproStepsEnabledWithNoScreenshot", ENABLED_WITH_NO_SCREENSHOT);
constants.put("reproStepsEnabled", ENABLED);
constants.put("reproStepsDisabled", DISABLED);
constants.put("shakeHint", SHAKE_HINT);
constants.put("swipeHint", SWIPE_HINT);
constants.put("invalidEmailMessage", INVALID_EMAIL_MESSAGE);

View File

@ -670,6 +670,16 @@ module.exports = {
}
},
/**
* Sets whether user steps tracking is visual, non visula or disabled.
*
* @param {reproStepsMode} reproStepsMode An enum to set user steps tracking to be
* enabled, non visual or disabled.
*/
setReproStepsMode: function (reproStepsMode) {
Instabug.setReproStepsMode(reproStepsMode);
},
/**
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
*

View File

@ -405,8 +405,8 @@ RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) {
@"dismissTypeAddAtttachment": @(IBGDismissTypeAddAttachment),
@"reproStepsEnabled": @(IBGUserStepsModeEnable),
@"reproStepsDisabled": @(IBGUserStepsModeEnabledWithNoScreenshots),
@"reproStepsEnabledWithNoScreenshot": @(IBGUserStepsModeDisable),
@"reproStepsDisabled": @(IBGUserStepsModeDisable),
@"reproStepsEnabledWithNoScreenshot": @(IBGUserStepsModeEnabledWithNoScreenshots),
@"reportTypeBug": @(IBGReportTypeBug),
@"reportTypeFeedback": @(IBGReportTypeFeedback),