Skip to content

Commit

Permalink
Merge pull request #49 from Instabug/SALMAT/testRelease
Browse files Browse the repository at this point in the history
🐛 Fix the bug where the sdk gets invoked automatically at app lau…
  • Loading branch information
DevHossamHassan authored Jul 18, 2017
2 parents eac7935 + f4fc9d5 commit 35aed6e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
}
Expand Down Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35aed6e

Please sign in to comment.