File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
android/src/main/java/com/instabug/reactlibrary Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 5959import org .json .JSONObject ;
6060import org .json .JSONTokener ;
6161
62+ import java .io .File ;
6263import java .lang .reflect .InvocationTargetException ;
6364import java .lang .reflect .Method ;
6465import java .util .ArrayList ;
@@ -457,8 +458,10 @@ public void setVideoRecordingFloatingButtonPosition(String corner) {
457458 @ ReactMethod
458459 public void setFileAttachment (String fileUri , String fileNameWithExtension ) {
459460 try {
460- Uri uri = Uri .parse (fileUri );
461- mInstabug .setFileAttachment (uri , fileNameWithExtension );
461+ File file = new File (fileUri );
462+ if (file .exists ()) {
463+ Instabug .addFileAttachment (Uri .fromFile (file ), fileNameWithExtension );
464+ }
462465 } catch (Exception e ) {
463466 e .printStackTrace ();
464467 }
Original file line number Diff line number Diff 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 } ,
Original file line number Diff line number Diff line change @@ -88,7 +88,8 @@ - (dispatch_queue_t)methodQueue {
8888}
8989
9090RCT_EXPORT_METHOD (setFileAttachment:(NSString *)fileLocation) {
91- [Instabug setFileAttachment: fileLocation];
91+ NSURL *url = [NSURL URLWithString: fileLocation];
92+ [Instabug addFileAttachmentWithURL: url];
9293}
9394
9495RCT_EXPORT_METHOD (sendJSCrash:(NSDictionary *)stackTrace) {
Original file line number Diff line number Diff line change 11{
22 "name" : " instabug-reactnative" ,
3- "version" : " 8.0.12 " ,
3+ "version" : " 8.0.13 " ,
44 "description" : " React Native plugin for integrating the Instabug SDK" ,
55 "main" : " index.js" ,
66 "repository" : {
You can’t perform that action at this time.
0 commit comments