|
11 | 11 | import com.instabug.library.invocation.InstabugInvocationEvent;
|
12 | 12 | import com.instabug.library.invocation.InstabugInvocationMode;
|
13 | 13 | import com.instabug.library.invocation.util.InstabugVideoRecordingButtonCorner;
|
| 14 | +import com.instabug.library.visualusersteps.State; |
14 | 15 |
|
15 | 16 | import org.apache.cordova.CallbackContext;
|
16 | 17 | import org.apache.cordova.CordovaInterface;
|
@@ -173,7 +174,10 @@ public boolean execute(final String action, JSONArray args, final CallbackContex
|
173 | 174 | } else if ("setExtendedBugReportMode".equals(action)) {
|
174 | 175 | setExtendedBugReportMode(callbackContext, args.optString(0));
|
175 | 176 |
|
176 |
| - }else { |
| 177 | + } else if ("setReproStepsMode".equals(action)) { |
| 178 | + setReproStepsMode(callbackContext, args.optString(0)); |
| 179 | + |
| 180 | + } else { |
177 | 181 | // Method not found.
|
178 | 182 | return false;
|
179 | 183 | }
|
@@ -734,6 +738,31 @@ private void setExtendedBugReportMode(final CallbackContext callbackContext, Str
|
734 | 738 | }
|
735 | 739 | }
|
736 | 740 |
|
| 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 | + |
737 | 766 | /**
|
738 | 767 | * Adds intent extras for all options passed to activate().
|
739 | 768 | */
|
|
0 commit comments