Skip to content

Commit 9a8907a

Browse files
authored
🤝 Merge pull request #111 from Instabug/feature/new_release_apis
Feature/new release apis
2 parents c5b531f + 6ae1d16 commit 9a8907a

30 files changed

+207
-82
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ android {
2121

2222
dependencies {
2323
compile 'com.facebook.react:react-native:0.20.+'
24-
compile 'com.instabug.library:instabug:4.6.1'
24+
compile 'com.instabug.library:instabug:4.7.0'
2525

2626
}

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

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,15 +357,14 @@ public void setPrimaryColor(int primaryColor) {
357357
* @param {boolean} screenShot A boolean to enable or disable screenshot attachments.
358358
* @param {boolean} extraScreenShot A boolean to enable or disable extra screenshot attachments.
359359
* @param {boolean} galleryImage A boolean to enable or disable gallery image attachments.
360-
* @param {boolean} voiceNote A boolean to enable or disable voice note attachments.
361360
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
362361
*/
363362
@ReactMethod
364-
public void setAttachmentTypesEnabled(boolean screenshot, boolean extraScreenshot, boolean
365-
galleryImage, boolean voiceNote, boolean screenRecording) {
363+
public void setEnabledAttachmentTypes(boolean screenshot, boolean extraScreenshot, boolean
364+
galleryImage, boolean screenRecording) {
366365
try {
367-
mInstabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage,
368-
voiceNote, screenRecording);
366+
Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage,
367+
screenRecording);
369368
} catch (Exception e) {
370369
e.printStackTrace();
371370
}
@@ -672,6 +671,42 @@ public void clearLogs() {
672671
}
673672
}
674673

674+
/**
675+
* Returns true if the survey with a specific token was answered before.
676+
* Will return false if the token does not exist or if the survey was not answered before.
677+
*
678+
* @param surveyToken the attribute key as string
679+
* @param hasRespondedCallback A callback that gets invoked with the returned value of whether
680+
* the user has responded to the survey or not.
681+
* @return the desired value of whether the user has responded to the survey or not.
682+
*/
683+
@ReactMethod
684+
public void hasRespondedToSurveyWithToken(String surveyToken, Callback hasRespondedCallback) {
685+
boolean hasResponded;
686+
try {
687+
hasResponded = Instabug.hasRespondToSurvey(surveyToken);
688+
hasRespondedCallback.invoke(hasResponded);
689+
} catch (Exception e) {
690+
e.printStackTrace();
691+
}
692+
}
693+
694+
/**
695+
* Shows survey with a specific token.
696+
* Does nothing if there are no available surveys with that specific token.
697+
* Answered and cancelled surveys won't show up again.
698+
*
699+
* @param surveyToken A String with a survey token.
700+
*/
701+
@ReactMethod
702+
public void showSurveyWithToken(String surveyToken) {
703+
try {
704+
Instabug.showSurvey(surveyToken);
705+
} catch (Exception e) {
706+
e.printStackTrace();
707+
}
708+
}
709+
675710
/**
676711
* Sets user attribute to overwrite it's value or create a new one if it doesn't exist.
677712
*

index.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,29 @@ module.exports = {
103103

104104
},
105105

106+
/**
107+
* Shows survey with a specific token.
108+
* Does nothing if there are no available surveys with that specific token.
109+
* Answered and cancelled surveys won't show up again.
110+
* @param {string} surveyToken - A String with a survey token.
111+
*
112+
*/
113+
showSurveyWithToken: function (surveyToken) {
114+
Instabug.showSurveyWithToken(surveyToken);
115+
},
116+
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+
106129
/**
107130
* Sets a block of code to be executed just before the SDK's UI is presented.
108131
* This block is executed on the UI thread. Could be used for performing any
@@ -369,6 +392,7 @@ module.exports = {
369392
},
370393

371394
/**
395+
* @deprecated since version 2.3.0. Use {@link setEnabledAttachmentTypes} instead.
372396
* Sets whether attachments in bug reporting and in-app messaging are enabled or not.
373397
* @param {boolean} screenshot A boolean to enable or disable screenshot attachments.
374398
* @param {boolean} extraScreenshot A boolean to enable or disable extra
@@ -382,7 +406,21 @@ module.exports = {
382406
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
383407
*/
384408
setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording) {
385-
Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, voiceNote, screenRecording);
409+
Instabug.setEnabledAttachmentTypes(screenshot, extraScreenshot, galleryImage, screenRecording);
410+
},
411+
412+
/**
413+
* Sets whether attachments in bug reporting and in-app messaging are enabled or not.
414+
* @param {boolean} screenshot A boolean to enable or disable screenshot attachments.
415+
* @param {boolean} extraScreenshot A boolean to enable or disable extra
416+
* screenshot attachments.
417+
* @param {boolean} galleryImage A boolean to enable or disable gallery image
418+
* attachments. In iOS 10+,NSPhotoLibraryUsageDescription should be set in
419+
* info.plist to enable gallery image attachments.
420+
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
421+
*/
422+
setEnabledAttachmentTypes: function (screenshot, extraScreenshot, galleryImage, screenRecording) {
423+
Instabug.setEnabledAttachmentTypes(screenshot, extraScreenshot, galleryImage, screenRecording);
386424
},
387425

388426
/**

ios/Instabug.framework/Headers/Instabug.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Copyright: (c) 2013-2017 by Instabug, Inc., all rights reserved.
77
8-
Version: 7.5
8+
Version: 7.6.1
99
*/
1010

1111
#import <Foundation/Foundation.h>
@@ -618,8 +618,14 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r
618618
extraScreenShot:(BOOL)extraScreenShot
619619
galleryImage:(BOOL)galleryImage
620620
voiceNote:(BOOL)voiceNote
621-
screenRecording:(BOOL)screenRecording;
621+
screenRecording:(BOOL)screenRecording DEPRECATED_MSG_ATTRIBUTE("Starting from v8.0, use setAttachmentOptions: instead");
622622

623+
/**
624+
@brief Sets whether attachments in bug reporting and in-app messaging are enabled.
625+
626+
@param attachmentTypes A NS_OPTIONS to add enabled attachments type.
627+
*/
628+
+ (void)setEnabledAttachmentTypes:(IBGAttachmentType)attachmentTypes;
623629
/**
624630
@brief Enables/disables showing in-app notifications when the user receives a new message.
625631
@@ -1153,6 +1159,24 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l
11531159
*/
11541160
+ (void)setDidDismissSurveyHandler:(void (^)(void))didShowSurveyHandler;
11551161

1162+
/**
1163+
@brief Shows Survey with a specific token.
1164+
1165+
@discussion Does nothing if there are no available surveys with that specific token. Answered and canceled surveys won't show up again.
1166+
1167+
@param surveyToken A String with a survey token.
1168+
*/
1169+
+ (void)showSurveyWithToken:(NSString *)surveyToken;
1170+
1171+
/**
1172+
@brief Returns true if the survey with a specific token was answered before .
1173+
1174+
@discussion Will return false if the token does not exist or if the survey was not answered before.
1175+
1176+
@param surveyToken A String with a survey token.
1177+
*/
1178+
+ (BOOL)hasRespondedToSurveyWithToken:(NSString *)surveyToken;
1179+
11561180
#pragma mark - SDK Debugging
11571181

11581182
/**

ios/Instabug.framework/Info.plist

2 Bytes
Binary file not shown.

ios/Instabug.framework/Instabug

16.6 KB
Binary file not shown.

ios/Instabug.framework/_CodeSignature/CodeResources

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<dict>
77
<key>Headers/Instabug.h</key>
88
<data>
9-
xcDqpr1ALuKw7dmbnzNWh8B2H0M=
9+
wbRGHXdBl0uQRZhJAsvdO+5ARfU=
1010
</data>
1111
<key>Info.plist</key>
1212
<data>
13-
uZAnUh7C/NBKYvvbjRZxsn2h8cw=
13+
lCGWkFUMspzePxMCyoe61a364pw=
1414
</data>
1515
<key>Modules/module.modulemap</key>
1616
<data>
@@ -23,11 +23,11 @@
2323
<dict>
2424
<key>hash</key>
2525
<data>
26-
xcDqpr1ALuKw7dmbnzNWh8B2H0M=
26+
wbRGHXdBl0uQRZhJAsvdO+5ARfU=
2727
</data>
2828
<key>hash2</key>
2929
<data>
30-
RH1mGgfTfrjNKsUKU/GyzsXbdlyVqmYPdD2tqPYFFUo=
30+
/beRz83/JfRE3ERsVSNwUaAFbEc3w28rX4aVpoNOC9k=
3131
</data>
3232
</dict>
3333
<key>Modules/module.modulemap</key>

ios/InstabugCore.framework/Headers/IBGTypes.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ typedef NS_ENUM(NSInteger, IBGLogLevel) {
291291
IBGLogLevelFatal
292292
};
293293

294+
/**
295+
The attachment types selected in Attachment action sheet.
296+
*/
297+
typedef NS_OPTIONS(NSInteger, IBGAttachmentType) {
298+
IBGAttachmentTypeScreenShot = 1 << 1,
299+
IBGAttachmentTypeExtraScreenShot = 1 << 2,
300+
IBGAttachmentTypeGalleryImage = 1 << 4,
301+
IBGAttachmentTypeScreenRecording = 1 << 6,
302+
};
303+
294304
@interface UIView (Instabug)
295305

296306
/**
-2 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-10 Bytes
Binary file not shown.
1 Byte
Binary file not shown.
Binary file not shown.
-10 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
5 Bytes
Binary file not shown.
6 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

ios/InstabugCore.framework/Info.plist

2 Bytes
Binary file not shown.
-32.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)