Skip to content

Commit cccb8d3

Browse files
committed
✨ Android - Add api for hasRespondedToSurvey
1 parent 23f8ae1 commit cccb8d3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,26 @@ public void clearLogs() {
672672
}
673673
}
674674

675+
/**
676+
* Returns true if the survey with a specific token was answered before.
677+
* Will return false if the token does not exist or if the survey was not answered before.
678+
*
679+
* @param surveyToken the attribute key as string
680+
* @param hasRespondedCallback A callback that gets invoked with the returned value of whether
681+
* the user has responded to the survey or not.
682+
* @return the desired value of whether the user has responded to the survey or not.
683+
*/
684+
@ReactMethod
685+
public void hasRespondedToSurveyWithToken(String surveyToken, Callback hasRespondedCallback) {
686+
boolean hasResponded;
687+
try {
688+
hasResponded = Instabug.hasRespondToSurvey(surveyToken);
689+
hasRespondedCallback.invoke(hasResponded);
690+
} catch (Exception e) {
691+
e.printStackTrace();
692+
}
693+
}
694+
675695
/**
676696
* Shows survey with a specific token.
677697
* Does nothing if there are no available surveys with that specific token.

0 commit comments

Comments
 (0)