Skip to content

Commit 2545f7f

Browse files
Enable setPostInvocationHandler API for android
1 parent bb6d1ac commit 2545f7f

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import com.instabug.library.bugreporting.model.ReportCategory;
2424
import com.instabug.library.InstabugCustomTextPlaceHolder;
2525
import com.instabug.library.user.UserEventParam;
26+
import com.instabug.library.OnSdkDismissedCallback;
27+
import com.instabug.library.bugreporting.model.Bug;
2628

2729
import com.instabug.reactlibrary.utils.ArrayUtil;
2830
import com.instabug.reactlibrary.utils.MapUtil;
@@ -925,6 +927,30 @@ public void run() {
925927
}
926928
}
927929

930+
/**
931+
* Sets a block of code to be executed right after the SDK's UI is dismissed.
932+
* This block is executed on the UI thread. Could be used for performing any
933+
* UI changes after the SDK's UI is dismissed.
934+
*
935+
* @param {postInvocationHandler} postInvocationHandler - A callback to get executed after
936+
* dismissing the SDK.
937+
*/
938+
@ReactMethod
939+
public void setPostInvocationHandler(final Callback postInvocationHandler) {
940+
try {
941+
942+
mInstabug.setOnSdkDismissedCallback(new OnSdkDismissedCallback() {
943+
@Override
944+
public void onSdkDismissed(DismissType issueState, Bug.Type bugType) {
945+
postInvocationHandler.invoke();
946+
}
947+
});
948+
949+
} catch (java.lang.Exception exception) {
950+
exception.printStackTrace();
951+
}
952+
}
953+
928954
private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
929955
String keyInLowerCase = key.toLowerCase();
930956
switch (keyInLowerCase) {

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ module.exports = {
150150
postInvocationHandler(payload['dismissType'], payload['reportType']);
151151
}
152152
);
153-
154-
Instabug.setPostInvocationHandler(postInvocationHandler);
155153
}
154+
155+
Instabug.setPostInvocationHandler(postInvocationHandler);
156+
156157
},
157158

158159
/**

0 commit comments

Comments
 (0)