@@ -123,7 +123,7 @@ public void setEnabled(final boolean isEnabled) {
123
123
@ Override
124
124
public void run () {
125
125
try {
126
- if (isEnabled )
126
+ if (isEnabled )
127
127
Instabug .enable ();
128
128
else
129
129
Instabug .disable ();
@@ -136,10 +136,11 @@ public void run() {
136
136
137
137
/**
138
138
* Initializes the SDK.
139
- * @param token The token that identifies the app. You can find it on your dashboard.
139
+ *
140
+ * @param token The token that identifies the app. You can find it on your dashboard.
140
141
* @param invocationEventValues The events that invoke the SDK's UI.
141
- * @param logLevel The level of detail in logs that you want to print.
142
- * @param codePushVersion The Code Push version to be used for all reports.
142
+ * @param logLevel The level of detail in logs that you want to print.
143
+ * @param codePushVersion The Code Push version to be used for all reports.
143
144
*/
144
145
@ ReactMethod
145
146
public void init (
@@ -165,8 +166,8 @@ public void run() {
165
166
.setInvocationEvents (invocationEvents )
166
167
.setLogLevel (parsedLogLevel );
167
168
168
- if (codePushVersion != null ) {
169
- if (Instabug .isBuilt ()) {
169
+ if (codePushVersion != null ) {
170
+ if (Instabug .isBuilt ()) {
170
171
Instabug .setCodePushVersion (codePushVersion );
171
172
} else {
172
173
builder .setCodePushVersion (codePushVersion );
@@ -332,7 +333,7 @@ public void run() {
332
333
*
333
334
* @param userEmail User's default email
334
335
* @param userName Username.
335
- * @param userId User's ID
336
+ * @param userId User's ID
336
337
*/
337
338
@ ReactMethod
338
339
public void identifyUser (
@@ -752,15 +753,15 @@ public void addFileAttachmentWithDataToReport(String data, String fileName) {
752
753
753
754
private WritableMap convertFromHashMapToWriteableMap (HashMap hashMap ) {
754
755
WritableMap writableMap = new WritableNativeMap ();
755
- for (int i = 0 ; i < hashMap .size (); i ++) {
756
+ for (int i = 0 ; i < hashMap .size (); i ++) {
756
757
Object key = hashMap .keySet ().toArray ()[i ];
757
758
Object value = hashMap .get (key );
758
- writableMap .putString ((String ) key ,(String ) value );
759
+ writableMap .putString ((String ) key , (String ) value );
759
760
}
760
761
return writableMap ;
761
762
}
762
763
763
- private static JSONObject objectToJSONObject (Object object ){
764
+ private static JSONObject objectToJSONObject (Object object ) {
764
765
Object json = null ;
765
766
JSONObject jsonObject = null ;
766
767
try {
@@ -777,13 +778,12 @@ private static JSONObject objectToJSONObject(Object object){
777
778
private WritableArray convertArrayListToWritableArray (List arrayList ) {
778
779
WritableArray writableArray = new WritableNativeArray ();
779
780
780
- for (int i = 0 ; i < arrayList .size (); i ++) {
781
+ for (int i = 0 ; i < arrayList .size (); i ++) {
781
782
Object object = arrayList .get (i );
782
783
783
- if (object instanceof String ) {
784
+ if (object instanceof String ) {
784
785
writableArray .pushString ((String ) object );
785
- }
786
- else {
786
+ } else {
787
787
JSONObject jsonObject = objectToJSONObject (object );
788
788
writableArray .pushMap ((WritableMap ) jsonObject );
789
789
}
@@ -839,7 +839,7 @@ public void run() {
839
839
* Shows the welcome message in a specific mode.
840
840
*
841
841
* @param welcomeMessageMode An enum to set the welcome message mode to
842
- * live, or beta.
842
+ * live, or beta.
843
843
*/
844
844
@ ReactMethod
845
845
public void showWelcomeMessageWithMode (final String welcomeMessageMode ) {
@@ -861,7 +861,7 @@ public void run() {
861
861
* Sets the welcome message mode to live, beta or disabled.
862
862
*
863
863
* @param welcomeMessageMode An enum to set the welcome message mode to
864
- * live, beta or disabled.
864
+ * live, beta or disabled.
865
865
*/
866
866
@ ReactMethod
867
867
public void setWelcomeMessageMode (final String welcomeMessageMode ) {
@@ -996,7 +996,6 @@ public void run() {
996
996
* Reports that the screen name been changed (Current View).
997
997
*
998
998
* @param screenName string containing the screen name
999
- *
1000
999
*/
1001
1000
@ ReactMethod
1002
1001
public void reportCurrentViewChange (final String screenName ) {
@@ -1019,7 +1018,6 @@ public void run() {
1019
1018
* Reports that the screen has been changed (Repro Steps) the screen sent to this method will be the 'current view' on the dashboard
1020
1019
*
1021
1020
* @param screenName string containing the screen name
1022
- *
1023
1021
*/
1024
1022
@ ReactMethod
1025
1023
public void reportScreenChange (final String screenName ) {
@@ -1029,7 +1027,7 @@ public void run() {
1029
1027
try {
1030
1028
Method method = getMethod (Class .forName ("com.instabug.library.Instabug" ), "reportScreenChange" , Bitmap .class , String .class );
1031
1029
if (method != null ) {
1032
- method .invoke (null , null , screenName );
1030
+ method .invoke (null , null , screenName );
1033
1031
}
1034
1032
} catch (Exception e ) {
1035
1033
e .printStackTrace ();
@@ -1123,7 +1121,7 @@ public void removeFeatureFlags(final ReadableArray featureFlags) {
1123
1121
@ Override
1124
1122
public void run () {
1125
1123
try {
1126
- ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
1124
+ ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
1127
1125
Instabug .removeFeatureFlag (stringArray );
1128
1126
} catch (Exception e ) {
1129
1127
e .printStackTrace ();
@@ -1159,11 +1157,12 @@ public void run() {
1159
1157
}
1160
1158
});
1161
1159
}
1160
+
1162
1161
/**
1163
1162
* Register a listener for W3C flags value change
1164
1163
*/
1165
1164
@ ReactMethod
1166
- public void registerW3CFlagsChangeListener (){
1165
+ public void registerW3CFlagsChangeListener () {
1167
1166
1168
1167
MainThreadHandler .runOnMainThread (new Runnable () {
1169
1168
@ Override
@@ -1180,8 +1179,7 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
1180
1179
sendEvent (Constants .IBG_ON_NEW_W3C_FLAGS_UPDATE_RECEIVED_CALLBACK , params );
1181
1180
}
1182
1181
});
1183
- }
1184
- catch (Exception e ) {
1182
+ } catch (Exception e ) {
1185
1183
e .printStackTrace ();
1186
1184
}
1187
1185
@@ -1192,18 +1190,17 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
1192
1190
1193
1191
1194
1192
/**
1195
- * Get first time Value of W3ExternalTraceID flag
1193
+ * Get first time Value of W3ExternalTraceID flag
1196
1194
*/
1197
1195
@ ReactMethod
1198
- public void isW3ExternalTraceIDEnabled (Promise promise ){
1196
+ public void isW3ExternalTraceIDEnabled (Promise promise ) {
1199
1197
1200
1198
MainThreadHandler .runOnMainThread (new Runnable () {
1201
1199
@ Override
1202
1200
public void run () {
1203
1201
try {
1204
1202
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_EXTERNAL_TRACE_ID ));
1205
- }
1206
- catch (Exception e ) {
1203
+ } catch (Exception e ) {
1207
1204
e .printStackTrace ();
1208
1205
promise .resolve (false );
1209
1206
}
@@ -1215,18 +1212,17 @@ public void run() {
1215
1212
1216
1213
1217
1214
/**
1218
- * Get first time Value of W3ExternalGeneratedHeader flag
1215
+ * Get first time Value of W3ExternalGeneratedHeader flag
1219
1216
*/
1220
1217
@ ReactMethod
1221
- public void isW3ExternalGeneratedHeaderEnabled (Promise promise ){
1218
+ public void isW3ExternalGeneratedHeaderEnabled (Promise promise ) {
1222
1219
1223
1220
MainThreadHandler .runOnMainThread (new Runnable () {
1224
1221
@ Override
1225
1222
public void run () {
1226
1223
try {
1227
1224
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_GENERATED_HEADER ));
1228
- }
1229
- catch (Exception e ) {
1225
+ } catch (Exception e ) {
1230
1226
e .printStackTrace ();
1231
1227
promise .resolve (false );
1232
1228
}
@@ -1237,18 +1233,17 @@ public void run() {
1237
1233
}
1238
1234
1239
1235
/**
1240
- * Get first time Value of W3CaughtHeader flag
1236
+ * Get first time Value of W3CaughtHeader flag
1241
1237
*/
1242
1238
@ ReactMethod
1243
- public void isW3CaughtHeaderEnabled (Promise promise ){
1239
+ public void isW3CaughtHeaderEnabled (Promise promise ) {
1244
1240
1245
1241
MainThreadHandler .runOnMainThread (new Runnable () {
1246
1242
@ Override
1247
1243
public void run () {
1248
1244
try {
1249
1245
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_CAPTURED_HEADER ));
1250
- }
1251
- catch (Exception e ) {
1246
+ } catch (Exception e ) {
1252
1247
e .printStackTrace ();
1253
1248
promise .resolve (false );
1254
1249
}
@@ -1278,6 +1273,31 @@ public Map<String, Object> getConstants() {
1278
1273
return constants ;
1279
1274
}
1280
1275
1276
+ /**
1277
+ * Sets the auto mask screenshots types.
1278
+ *
1279
+ * @param autoMaskingTypes The masking type to be applied.
1280
+ */
1281
+ @ ReactMethod
1282
+ public void enableAutoMasking (@ NonNull ReadableArray autoMaskingTypes ) {
1283
+ MainThreadHandler .runOnMainThread (new Runnable () {
1284
+
1285
+ @ Override
1286
+ public void run () {
1287
+ int [] autoMassingTypesArray = new int [autoMaskingTypes .size ()];
1288
+ for (int i = 0 ; i < autoMaskingTypes .size (); i ++) {
1289
+ String key = autoMaskingTypes .getString (i );
1290
+
1291
+ autoMassingTypesArray [i ] = ArgsRegistry .autoMaskingTypes .get (key );
1292
+
1293
+ }
1294
+
1295
+ Instabug .setAutoMaskScreenshotsTypes (autoMassingTypesArray );
1296
+ }
1297
+
1298
+ });
1299
+ }
1300
+
1281
1301
@ ReactMethod
1282
1302
public void setOnFeaturesUpdatedListener () {
1283
1303
InternalCore .INSTANCE ._setOnFeaturesUpdatedListener (new OnFeaturesUpdatedListener () {
0 commit comments