Skip to content

Commit 39e650e

Browse files
committed
✨ setReproSteps API
1 parent 885dbcd commit 39e650e

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

src/android/IBGPlugin.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.instabug.library.invocation.InstabugInvocationEvent;
1212
import com.instabug.library.invocation.InstabugInvocationMode;
1313
import com.instabug.library.invocation.util.InstabugVideoRecordingButtonCorner;
14+
import com.instabug.library.visualusersteps.State;
1415

1516
import org.apache.cordova.CallbackContext;
1617
import org.apache.cordova.CordovaInterface;
@@ -173,7 +174,10 @@ public boolean execute(final String action, JSONArray args, final CallbackContex
173174
} else if ("setExtendedBugReportMode".equals(action)) {
174175
setExtendedBugReportMode(callbackContext, args.optString(0));
175176

176-
}else {
177+
} else if ("setReproStepsMode".equals(action)) {
178+
setReproStepsMode(callbackContext, args.optString(0));
179+
180+
} else {
177181
// Method not found.
178182
return false;
179183
}
@@ -734,6 +738,31 @@ private void setExtendedBugReportMode(final CallbackContext callbackContext, Str
734738
}
735739
}
736740

741+
/**
742+
* Sets whether user steps tracking is visual, non visual or disabled.
743+
* User Steps tracking is enabled by default if it's available
744+
* in your current plan.
745+
*
746+
* @param callbackContext
747+
* Used when calling back into JavaScript
748+
* @param reproStepsMode
749+
* A string to set user steps tracking to be enabled,
750+
* non visual or disabled.
751+
*/
752+
private void setReproStepsMode(final CallbackContext callbackContext, String reproStepsMode) {
753+
try {
754+
if(reproStepsMode.equals("enabledWithNoScreenshots")) {
755+
Instabug.setReproStepsState(State.ENABLED_WITH_NO_SCREENSHOTS);
756+
} else if(reproStepsMode.equals("enabled")) {
757+
Instabug.setReproStepsState(State.ENABLED);
758+
} else if(reproStepsMode.equals("disabled")) {
759+
Instabug.setReproStepsState(State.DISABLED);
760+
}
761+
} catch (IllegalStateException e) {
762+
callbackContext.error(errorMsg);
763+
}
764+
}
765+
737766
/**
738767
* Adds intent extras for all options passed to activate().
739768
*/

src/ios/IBGPlugin.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ - (void) setLocale:(CDVInvokedUrlCommand*)command
395395
}
396396

397397
/**
398-
* Sets whether user steps tracking is visual, non visula or disabled.
398+
* Sets whether user steps tracking is visual, non visual or disabled.
399399
*
400400
* @param {CDVInvokedUrlCommand*} command
401401
* The command sent from JavaScript
@@ -757,7 +757,7 @@ - (IBGUserStepsMode) parseReproStepsMode:(NSString*)mode
757757
return IBGUserStepsModeEnable;
758758
} else if ([mode isEqualToString:@"disabled"]) {
759759
return IBGUserStepsModeDisable;
760-
} else if ([mode isEqualToString:@"enabledWithNoScreenshot"]) {
760+
} else if ([mode isEqualToString:@"enabledWithNoScreenshots"]) {
761761
return IBGUserStepsModeEnabledWithNoScreenshots;
762762
} else return 0;
763763
}

www/instabug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var getReproStepsMode = function () {
2424
return {
2525
enabled: 'enabled',
2626
disabled: 'disabled',
27-
enabledWithNoScreenshot: 'enabledWithNoScreenshot'
27+
enabledWithNoScreenshots: 'enabledWithNoScreenshots'
2828
};
2929
};
3030

0 commit comments

Comments
 (0)