iOS - Add new api for hasRespondedToSurveyWithToken

This commit is contained in:
Salma ElTarzi 2018-01-04 10:45:00 +02:00
parent bc1b5bdb23
commit f55cc4d582
2 changed files with 16 additions and 0 deletions

View File

@ -114,6 +114,18 @@ module.exports = {
Instabug.showSurveyWithToken(surveyToken);
},
/**
* Returns true if the survey with a specific token was answered before.
* Will return false if the token does not exist or if the survey was not answered before.
* @param {string} surveyToken - A String with a survey token.
* @param {function} surveyTokenCallback callback with argument as the desired value of the whether
* the survey has been responded to or not.
*
*/
hasRespondedToSurveyWithToken: function (surveyToken, surveyTokenCallback) {
Instabug.hasRespondedToSurveyWithToken(surveyToken, surveyTokenCallback);
},
/**
* Sets a block of code to be executed just before the SDK's UI is presented.
* This block is executed on the UI thread. Could be used for performing any

View File

@ -65,6 +65,10 @@ RCT_EXPORT_METHOD(showSurveyWithToken:(NSString *)surveyToken) {
[Instabug showSurveyWithToken:surveyToken];
}
RCT_EXPORT_METHOD(hasRespondedToSurveyWithToken:(NSString *)surveyToken callback:(RCTResponseSenderBlock)callback) {
callback(@[@([Instabug hasRespondedToSurveyWithToken:surveyToken])]);
}
RCT_EXPORT_METHOD(setUserStepsEnabled:(BOOL)isUserStepsEnabled) {
[Instabug setUserStepsEnabled:isUserStepsEnabled];
}