Skip to content

Commit 8b35de8

Browse files
committed
✨ Add setThresholdForReshowingSurveyAfterDismiss API for Android
1 parent c9e6969 commit 8b35de8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/android/IBGPlugin.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ public boolean execute(final String action, JSONArray args, final CallbackContex
177177
} else if ("setReproStepsMode".equals(action)) {
178178
setReproStepsMode(callbackContext, args.optString(0));
179179

180+
} else if ("setThresholdForReshowingSurveyAfterDismiss".equals(action)) {
181+
setThresholdForReshowingSurveyAfterDismiss(callbackContext, args.optInt(0), args.optInt(1));
182+
180183
} else {
181184
// Method not found.
182185
return false;
@@ -763,6 +766,28 @@ private void setReproStepsMode(final CallbackContext callbackContext, String rep
763766
}
764767
}
765768

769+
770+
/**
771+
* Set after how many sessions should the dismissed survey would show again.
772+
*
773+
* @param callbackContext
774+
* Used when calling back into JavaScript
775+
* @param sessionsCount
776+
* number of sessions that the dismissed survey will be shown after.
777+
* @param daysCount
778+
* number of days that the dismissed survey will show after.
779+
*/
780+
private void setThresholdForReshowingSurveyAfterDismiss(final CallbackContext callbackContext, int sessionsCount, int daysCount) {
781+
if (Math.signum(sessionsCount) != - 1 && Math.signum(daysCount) != - 1) {
782+
try {
783+
Instabug.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount);
784+
callbackContext.success();
785+
} catch (IllegalStateException e) {
786+
callbackContext.error(errorMsg);
787+
}
788+
} else callbackContext.error("Session count and days count must be provided.");
789+
}
790+
766791
/**
767792
* Adds intent extras for all options passed to activate().
768793
*/

0 commit comments

Comments
 (0)