88#import < Instabug/Instabug.h>
99#import < Instabug/IBGBugReporting.h>
1010#import < Instabug/IBGCrashReporting.h>
11+ #import < Instabug/IBGSurveys.h>
1112#import < Instabug/IBGLog.h>
1213#import < asl.h>
1314#import < React/RCTLog.h>
@@ -96,11 +97,11 @@ - (dispatch_queue_t)methodQueue {
9697}
9798
9899RCT_EXPORT_METHOD (showSurveyWithToken:(NSString *)surveyToken) {
99- [Instabug showSurveyWithToken: surveyToken];
100+ [IBGSurveys showSurveyWithToken: surveyToken];
100101}
101102
102103RCT_EXPORT_METHOD (hasRespondedToSurveyWithToken:(NSString *)surveyToken callback:(RCTResponseSenderBlock)callback) {
103- callback (@[@([Instabug hasRespondedToSurveyWithToken: surveyToken])]);
104+ callback (@[@([IBGSurveys hasRespondedToSurveyWithToken: surveyToken])]);
104105}
105106
106107RCT_EXPORT_METHOD (setUserStepsEnabled:(BOOL )isUserStepsEnabled) {
@@ -367,6 +368,10 @@ - (dispatch_queue_t)methodQueue {
367368 Instabug.shouldCaptureViewHierarchy = viewHierarchyEnabled;
368369}
369370
371+ RCT_EXPORT_METHOD (getAvailableSurveys:(RCTResponseSenderBlock)callback) {
372+ callback (@[[IBGSurveys availableSurveys ]]);
373+ }
374+
370375RCT_EXPORT_METHOD (logUserEventWithName:(NSString *)name) {
371376 [Instabug logUserEventWithName: name];
372377}
@@ -400,30 +405,30 @@ - (dispatch_queue_t)methodQueue {
400405}
401406
402407RCT_EXPORT_METHOD (setSurveysEnabled:(BOOL )surveysEnabled) {
403- [Instabug setSurveysEnabled: surveysEnabled] ;
408+ IBGSurveys. enabled = surveysEnabled;
404409}
405410
406411RCT_EXPORT_METHOD (showSurveysIfAvailable) {
407- [Instabug showSurveyIfAvailable ];
412+ [IBGSurveys showSurveyIfAvailable ];
408413}
409414
410415RCT_EXPORT_METHOD (setWillShowSurveyHandler:(RCTResponseSenderBlock)callBack) {
411416 if (callBack != nil ) {
412- [Instabug setWillShowSurveyHandler: ^{
417+ IBGSurveys. willShowSurveyHandler = ^{
413418 [self sendEventWithName: @" IBGWillShowSurvey" body: nil ];
414- }] ;
419+ };
415420 } else {
416- [Instabug setWillShowSurveyHandler: nil ] ;
421+ IBGSurveys. willShowSurveyHandler = nil ;
417422 }
418423}
419424
420425RCT_EXPORT_METHOD (setDidDismissSurveyHandler:(RCTResponseSenderBlock)callBack) {
421426 if (callBack != nil ) {
422- [Instabug setDidDismissSurveyHandler: ^{
427+ IBGSurveys. didDismissSurveyHandler = ^{
423428 [self sendEventWithName: @" IBGDidDismissSurvey" body: nil ];
424- }] ;
429+ };
425430 } else {
426- [Instabug setDidDismissSurveyHandler: nil ] ;
431+ IBGSurveys. didDismissSurveyHandler = nil ;
427432 }
428433}
429434
@@ -432,15 +437,15 @@ - (dispatch_queue_t)methodQueue {
432437}
433438
434439RCT_EXPORT_METHOD (setAutoShowingSurveysEnabled:(BOOL )autoShowingSurveysEnabled) {
435- [Instabug setAutoShowingSurveysEnabled: autoShowingSurveysEnabled] ;
440+ IBGSurveys. autoShowingEnabled = autoShowingSurveysEnabled;
436441}
437442
438443RCT_EXPORT_METHOD (setVideoRecordingFloatingButtonPosition:(IBGPosition)position) {
439444 IBGBugReporting.videoRecordingFloatingButtonPosition = position;
440445}
441446
442447RCT_EXPORT_METHOD (setThresholdForReshowingSurveyAfterDismiss:(NSInteger )sessionCount daysCount:(NSInteger )daysCount) {
443- [Instabug setThresholdForReshowingSurveyAfterDismiss: sessionCount daysCount: daysCount];
448+ [IBGSurveys setThresholdForReshowingSurveyAfterDismiss: sessionCount daysCount: daysCount];
444449}
445450
446451RCT_EXPORT_METHOD (setSessionProfilerEnabled:(BOOL )sessionProfilerEnabled) {
@@ -452,7 +457,7 @@ - (dispatch_queue_t)methodQueue {
452457}
453458
454459RCT_EXPORT_METHOD (setShouldShowSurveysWelcomeScreen:(BOOL )shouldShowWelcomeScreen) {
455- [Instabug setShouldShowSurveysWelcomeScreen: shouldShowWelcomeScreen] ;
460+ IBGSurveys. shouldShowWelcomeScreen = shouldShowWelcomeScreen;
456461}
457462
458463RCT_EXPORT_METHOD (setEmailFieldRequiredForActions:(BOOL )isEmailFieldRequired
0 commit comments