File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
android/src/main/java/com/instabug/reactlibrary Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -901,6 +901,30 @@ public void run() {
901901 }
902902 }
903903
904+ /**
905+ * Sets a block of code to be executed before sending each report.
906+ * This block is executed in the background before sending each report. Could
907+ * be used for attaching logs and extra data to reports.
908+ *
909+ * @param {preSendingHandler} preSendingHandler - A callback that gets executed before
910+ * sending each bug
911+ * report.
912+ */
913+ @ ReactMethod
914+ public void setPreSendingHandler (final Callback preSendingHandler ) {
915+ try {
916+ Runnable preSendingRunnable = new Runnable () {
917+ @ Override
918+ public void run () {
919+ preSendingHandler .invoke ();
920+ }
921+ };
922+ mInstabug .setPreSendingRunnable (preSendingRunnable );
923+ } catch (java .lang .Exception exception ) {
924+ exception .printStackTrace ();
925+ }
926+ }
927+
904928 private InstabugCustomTextPlaceHolder .Key getStringToKeyConstant (String key ) {
905929 String keyInLowerCase = key .toLowerCase ();
906930 switch (keyInLowerCase ) {
Original file line number Diff line number Diff line change @@ -109,8 +109,10 @@ module.exports = {
109109 preSendingHandler
110110 ) ;
111111
112- Instabug . setPreSendingHandler ( preSendingHandler ) ;
113112 }
113+
114+ Instabug . setPreSendingHandler ( preSendingHandler ) ;
115+
114116 } ,
115117
116118 /**
You can’t perform that action at this time.
0 commit comments