Enable setPostInvocationHandler API for android

This commit is contained in:
DevHossamHassan 2017-06-22 06:27:45 +02:00
parent bb6d1ac318
commit 2545f7f8a4
2 changed files with 29 additions and 2 deletions

View File

@ -23,6 +23,8 @@ import com.instabug.library.logging.InstabugLog;
import com.instabug.library.bugreporting.model.ReportCategory;
import com.instabug.library.InstabugCustomTextPlaceHolder;
import com.instabug.library.user.UserEventParam;
import com.instabug.library.OnSdkDismissedCallback;
import com.instabug.library.bugreporting.model.Bug;
import com.instabug.reactlibrary.utils.ArrayUtil;
import com.instabug.reactlibrary.utils.MapUtil;
@ -925,6 +927,30 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
}
}
/**
* Sets a block of code to be executed right after the SDK's UI is dismissed.
* This block is executed on the UI thread. Could be used for performing any
* UI changes after the SDK's UI is dismissed.
*
* @param {postInvocationHandler} postInvocationHandler - A callback to get executed after
* dismissing the SDK.
*/
@ReactMethod
public void setPostInvocationHandler(final Callback postInvocationHandler) {
try {
mInstabug.setOnSdkDismissedCallback(new OnSdkDismissedCallback() {
@Override
public void onSdkDismissed(DismissType issueState, Bug.Type bugType) {
postInvocationHandler.invoke();
}
});
} catch (java.lang.Exception exception) {
exception.printStackTrace();
}
}
private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
String keyInLowerCase = key.toLowerCase();
switch (keyInLowerCase) {

View File

@ -150,9 +150,10 @@ module.exports = {
postInvocationHandler(payload['dismissType'], payload['reportType']);
}
);
Instabug.setPostInvocationHandler(postInvocationHandler);
}
Instabug.setPostInvocationHandler(postInvocationHandler);
},
/**