Skip to content

Commit 76cec53

Browse files
committed
✨ Add setViewHierarchyEnabled API - Android
1 parent e14d346 commit 76cec53

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.facebook.react.bridge.Callback;
2020

2121
import com.facebook.react.modules.core.DeviceEventManagerModule;
22+
import com.instabug.library.Feature;
2223
import com.instabug.library.Instabug;
2324
import com.instabug.library.internal.module.InstabugLocale;
2425
import com.instabug.library.invocation.InstabugInvocationEvent;
@@ -247,6 +248,20 @@ public void changeLocale(String instabugLocale) {
247248
}
248249
}
249250

251+
@ReactMethod
252+
public void setViewHierarchyEnabled(boolean enabled) {
253+
try {
254+
if(enabled) {
255+
Instabug.setViewHierarchyState(Feature.State.ENABLED);
256+
} else {
257+
258+
Instabug.setViewHierarchyState(Feature.State.DISABLED);
259+
}
260+
} catch (Exception e) {
261+
e.printStackTrace();
262+
}
263+
}
264+
250265
/**
251266
* Sets the default corner at which the video recording floating button will be shown
252267
*

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.instabug.library.InstabugColorTheme;
1313
import com.instabug.library.invocation.InstabugInvocationEvent;
1414
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
15+
import com.instabug.library.visualusersteps.State;
1516
import android.graphics.Color;
1617

1718
import java.util.ArrayList;
@@ -56,6 +57,7 @@ public RNInstabugReactnativePackage(String androidApplicationToken, Application
5657
mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken)
5758
.setInvocationEvent(this.invocationEvent)
5859
.setCrashReportingState(Feature.State.DISABLED)
60+
.setReproStepsState(State.DISABLED)
5961
.build();
6062

6163
Instabug.setPrimaryColor(Color.parseColor(primaryColor));

index.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ module.exports = {
4949
Instabug.dismiss();
5050
},
5151

52-
/**
53-
* Sets whether user steps tracking is visual, non visula or disabled.
54-
*
55-
* @param {reproStepsMode} reproStepsMode An enum to set user steps tracking to be
56-
* enabled, non visual or disabled.
57-
*/
58-
setReproStepsMode: function (reproStepsMode) {
59-
Instabug.setReproStepsMode(reproStepsMode);
60-
},
61-
6252
/**
6353
* Attaches user data to each report being sent.
6454
* Each call to this method overrides the user data to be attached.
@@ -700,9 +690,7 @@ module.exports = {
700690
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
701691
*/
702692
setViewHierarchyEnabled: function (viewHierarchyEnabled) {
703-
if (Platform.OS === 'ios') {
704-
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
705-
}
693+
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
706694
},
707695

708696
/**

0 commit comments

Comments
 (0)