Skip to content

Commit d2cf347

Browse files
committed
📝 Adjust setAttachmentTypesEnabled api to account for the change in the native api and removing the voice note attribute
1 parent 0d6e4ae commit d2cf347

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ module.exports = {
402402
* @param {boolean} screenRecording A boolean to enable or disable screen recording attachments.
403403
*/
404404
setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, screenRecording) {
405-
if(Platform.OS == 'android')
406405
Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, screenRecording);
407-
408406
},
409407

410408
/**

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import <asl.h>
1010
#import <React/RCTLog.h>
1111
#import <os/log.h>
12+
#import <InstabugCore/IBGTypes.h>
1213

1314
@implementation InstabugReactBridge
1415

@@ -184,16 +185,25 @@ - (dispatch_queue_t)methodQueue {
184185
}
185186

186187
RCT_EXPORT_METHOD(setAttachmentTypesEnabled:(BOOL)screenShot
187-
extraScreenShot:(BOOL)extraScreenShot
188-
galleryImage:(BOOL)galleryImage
189-
voiceNote:(BOOL)voiceNote
190-
screenRecording:(BOOL)screenRecording) {
191-
[Instabug setAttachmentTypesEnabledScreenShot:screenShot
192-
extraScreenShot:extraScreenShot
193-
galleryImage:galleryImage
194-
voiceNote:voiceNote
195-
screenRecording:screenRecording];
196-
}
188+
extraScreenShot:(BOOL)extraScreenShot
189+
galleryImage:(BOOL)galleryImage
190+
screenRecording:(BOOL)screenRecording) {
191+
IBGAttachmentType attachmentTypes = 0;
192+
if(screenShot) {
193+
attachmentTypes = IBGAttachmentTypeScreenShot;
194+
}
195+
if(extraScreenShot) {
196+
attachmentTypes |= IBGAttachmentTypeExtraScreenShot;
197+
}
198+
if(galleryImage) {
199+
attachmentTypes |= IBGAttachmentTypeGalleryImage;
200+
}
201+
if(screenRecording) {
202+
attachmentTypes |= IBGAttachmentTypeScreenRecording;
203+
}
204+
205+
[Instabug setEnabledAttachmentTypes:attachmentTypes];
206+
}
197207

198208
RCT_EXPORT_METHOD(setChatNotificationEnabled:(BOOL)isChatNotificationEnabled) {
199209
[Instabug setChatNotificationEnabled:isChatNotificationEnabled];

0 commit comments

Comments
 (0)