Skip to content

Commit f55cc4d

Browse files
committed
✨ iOS - Add new api for hasRespondedToSurveyWithToken
1 parent bc1b5bd commit f55cc4d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ module.exports = {
114114
Instabug.showSurveyWithToken(surveyToken);
115115
},
116116

117+
/**
118+
* Returns true if the survey with a specific token was answered before.
119+
* Will return false if the token does not exist or if the survey was not answered before.
120+
* @param {string} surveyToken - A String with a survey token.
121+
* @param {function} surveyTokenCallback callback with argument as the desired value of the whether
122+
* the survey has been responded to or not.
123+
*
124+
*/
125+
hasRespondedToSurveyWithToken: function (surveyToken, surveyTokenCallback) {
126+
Instabug.hasRespondedToSurveyWithToken(surveyToken, surveyTokenCallback);
127+
},
128+
117129
/**
118130
* Sets a block of code to be executed just before the SDK's UI is presented.
119131
* This block is executed on the UI thread. Could be used for performing any

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ - (dispatch_queue_t)methodQueue {
6565
[Instabug showSurveyWithToken:surveyToken];
6666
}
6767

68+
RCT_EXPORT_METHOD(hasRespondedToSurveyWithToken:(NSString *)surveyToken callback:(RCTResponseSenderBlock)callback) {
69+
callback(@[@([Instabug hasRespondedToSurveyWithToken:surveyToken])]);
70+
}
71+
6872
RCT_EXPORT_METHOD(setUserStepsEnabled:(BOOL)isUserStepsEnabled) {
6973
[Instabug setUserStepsEnabled:isUserStepsEnabled];
7074
}

0 commit comments

Comments
 (0)