From d2cf3479e916dbda3858891ab3116e646e67abcb Mon Sep 17 00:00:00 2001 From: Salma ElTarzi Date: Sat, 6 Jan 2018 13:11:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Adjust=20setAttachmentTypesEnabl?= =?UTF-8?q?ed=20api=20to=20account=20for=20the=20change=20in=20the=20nativ?= =?UTF-8?q?e=20api=20and=20removing=20the=20voice=20note=20attribute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 2 -- ios/RNInstabug/InstabugReactBridge.m | 30 ++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 3cfaa79..4b62481 100644 --- a/index.js +++ b/index.js @@ -402,9 +402,7 @@ module.exports = { * @param {boolean} screenRecording A boolean to enable or disable screen recording attachments. */ setAttachmentTypesEnabled: function (screenshot, extraScreenshot, galleryImage, screenRecording) { - if(Platform.OS == 'android') Instabug.setAttachmentTypesEnabled(screenshot, extraScreenshot, galleryImage, screenRecording); - }, /** diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index b307a46..bba46b1 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -9,6 +9,7 @@ #import #import #import +#import @implementation InstabugReactBridge @@ -184,16 +185,25 @@ RCT_EXPORT_METHOD(setString:(NSString*)value toKey:(IBGString)key) { } RCT_EXPORT_METHOD(setAttachmentTypesEnabled:(BOOL)screenShot - extraScreenShot:(BOOL)extraScreenShot - galleryImage:(BOOL)galleryImage - voiceNote:(BOOL)voiceNote - screenRecording:(BOOL)screenRecording) { - [Instabug setAttachmentTypesEnabledScreenShot:screenShot - extraScreenShot:extraScreenShot - galleryImage:galleryImage - voiceNote:voiceNote - screenRecording:screenRecording]; -} + extraScreenShot:(BOOL)extraScreenShot + galleryImage:(BOOL)galleryImage + screenRecording:(BOOL)screenRecording) { + IBGAttachmentType attachmentTypes = 0; + if(screenShot) { + attachmentTypes = IBGAttachmentTypeScreenShot; + } + if(extraScreenShot) { + attachmentTypes |= IBGAttachmentTypeExtraScreenShot; + } + if(galleryImage) { + attachmentTypes |= IBGAttachmentTypeGalleryImage; + } + if(screenRecording) { + attachmentTypes |= IBGAttachmentTypeScreenRecording; + } + + [Instabug setEnabledAttachmentTypes:attachmentTypes]; + } RCT_EXPORT_METHOD(setChatNotificationEnabled:(BOOL)isChatNotificationEnabled) { [Instabug setChatNotificationEnabled:isChatNotificationEnabled];