Skip to content

Commit 9ddd845

Browse files
committed
✨ add mapping for addFileAttachment
1 parent 9d972e8 commit 9ddd845

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public void setVideoRecordingFloatingButtonPosition(String corner) {
458458
public void setFileAttachment(String fileUri, String fileNameWithExtension) {
459459
try {
460460
Uri uri = Uri.parse(fileUri);
461-
mInstabug.setFileAttachment(uri, fileNameWithExtension);
461+
Instabug.addFileAttachment(uri, fileNameWithExtension);
462462
} catch (Exception e) {
463463
e.printStackTrace();
464464
}

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,19 @@ const InstabugModule = {
11891189
Instabug.setWelcomeMessageMode(welcomeMessageMode);
11901190
},
11911191

1192+
/**
1193+
* Add file to be attached to the bug report.
1194+
* @param {string} filePath
1195+
* @param {string} fileName
1196+
*/
1197+
addFileAttachment: function(filePath, fileName) {
1198+
if (Platform.OS === 'android') {
1199+
Instabug.setFileAttachment(filePath, fileName);
1200+
} else {
1201+
Instabug.setFileAttachment(filePath);
1202+
}
1203+
},
1204+
11921205
callPrivateApi: function(apiName, param) {
11931206
Instabug.callPrivateApi(apiName, param);
11941207
},

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ - (dispatch_queue_t)methodQueue {
8888
}
8989

9090
RCT_EXPORT_METHOD(setFileAttachment:(NSString *)fileLocation) {
91-
[Instabug setFileAttachment:fileLocation];
91+
NSURL *url = [NSURL URLWithString:fileLocation];
92+
[Instabug addFileAttachmentWithURL:url];
9293
}
9394

9495
RCT_EXPORT_METHOD(sendJSCrash:(NSDictionary *)stackTrace) {

0 commit comments

Comments
 (0)