🐛 Fix the bug where the sdk gets invoked automatically at app launch, and need to press twice on a button to manually invoke the sdk, fix a bug where changing the value of the strings did not work correctly

This commit is contained in:
Salma ElTarzi 2017-07-18 17:05:33 +02:00
parent 8d9db727b0
commit b8ec3be49a
2 changed files with 22 additions and 8 deletions

View File

@ -2,6 +2,8 @@ package com.instabug.reactlibrary;
import android.app.Application;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
@ -122,12 +124,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
super(reactContext);
this.androidApplication = androidApplication;
this.mInstabug = mInstabug;
try {
Instabug.invoke();
Instabug.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
//init placHolders
placeHolders = new InstabugCustomTextPlaceHolder();
}
@Override
@ -152,7 +150,13 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
@ReactMethod
public void invoke() {
try {
mInstabug.invoke();
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
mInstabug.invoke();
}
});
} catch (Exception e) {
e.printStackTrace();
}
@ -1105,7 +1109,7 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
String keyInLowerCase = key.toLowerCase();
switch (keyInLowerCase) {
switch (key) {
case SHAKE_HINT:
return InstabugCustomTextPlaceHolder.Key.SHAKE_HINT;
case SWIPE_HINT:

View File

@ -721,6 +721,16 @@ module.exports = {
Instabug.setPromptOptionsEnabled(chat, bug, feedback);
},
/**
* Enable/Disable debug logs from Instabug SDK
* Default state: disabled
*
* @param isDebugEnabled whether debug logs should be printed or not into LogCat
*/
setDebugEnabled: function(isDebugEnabled) {
Instabug.setDebugEnabled(isDebugEnabled);
},
/**
* Enables all Instabug functionality
* It works on android only