diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index 44b8cbf40..af6941c5c 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -2,6 +2,8 @@ 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 RNInstabugReactnativeModule(ReactApplicationContext reactContext, Applica 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 void startWithToken(String androidToken, String invocationEvent) { @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(); } @@ -1104,8 +1108,7 @@ public void run() { } 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: diff --git a/index.js b/index.js index 16339b169..894bd7d77 100644 --- a/index.js +++ b/index.js @@ -721,6 +721,18 @@ 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) { + if (Platform.OS === 'android') { + Instabug.setDebugEnabled(isDebugEnabled); + } + }, + /** * Enables all Instabug functionality * It works on android only