@@ -120,7 +120,7 @@ public void setEnabled(final boolean isEnabled) {
120
120
@ Override
121
121
public void run () {
122
122
try {
123
- if (isEnabled )
123
+ if (isEnabled )
124
124
Instabug .enable ();
125
125
else
126
126
Instabug .disable ();
@@ -133,10 +133,11 @@ public void run() {
133
133
134
134
/**
135
135
* Initializes the SDK.
136
- * @param token The token that identifies the app. You can find it on your dashboard.
136
+ *
137
+ * @param token The token that identifies the app. You can find it on your dashboard.
137
138
* @param invocationEventValues The events that invoke the SDK's UI.
138
- * @param logLevel The level of detail in logs that you want to print.
139
- * @param codePushVersion The Code Push version to be used for all reports.
139
+ * @param logLevel The level of detail in logs that you want to print.
140
+ * @param codePushVersion The Code Push version to be used for all reports.
140
141
*/
141
142
@ ReactMethod
142
143
public void init (
@@ -162,8 +163,8 @@ public void run() {
162
163
.setInvocationEvents (invocationEvents )
163
164
.setLogLevel (parsedLogLevel );
164
165
165
- if (codePushVersion != null ) {
166
- if (Instabug .isBuilt ()) {
166
+ if (codePushVersion != null ) {
167
+ if (Instabug .isBuilt ()) {
167
168
Instabug .setCodePushVersion (codePushVersion );
168
169
} else {
169
170
builder .setCodePushVersion (codePushVersion );
@@ -329,7 +330,7 @@ public void run() {
329
330
*
330
331
* @param userEmail User's default email
331
332
* @param userName Username.
332
- * @param userId User's ID
333
+ * @param userId User's ID
333
334
*/
334
335
@ ReactMethod
335
336
public void identifyUser (
@@ -749,15 +750,15 @@ public void addFileAttachmentWithDataToReport(String data, String fileName) {
749
750
750
751
private WritableMap convertFromHashMapToWriteableMap (HashMap hashMap ) {
751
752
WritableMap writableMap = new WritableNativeMap ();
752
- for (int i = 0 ; i < hashMap .size (); i ++) {
753
+ for (int i = 0 ; i < hashMap .size (); i ++) {
753
754
Object key = hashMap .keySet ().toArray ()[i ];
754
755
Object value = hashMap .get (key );
755
- writableMap .putString ((String ) key ,(String ) value );
756
+ writableMap .putString ((String ) key , (String ) value );
756
757
}
757
758
return writableMap ;
758
759
}
759
760
760
- private static JSONObject objectToJSONObject (Object object ){
761
+ private static JSONObject objectToJSONObject (Object object ) {
761
762
Object json = null ;
762
763
JSONObject jsonObject = null ;
763
764
try {
@@ -774,13 +775,12 @@ private static JSONObject objectToJSONObject(Object object){
774
775
private WritableArray convertArrayListToWritableArray (List arrayList ) {
775
776
WritableArray writableArray = new WritableNativeArray ();
776
777
777
- for (int i = 0 ; i < arrayList .size (); i ++) {
778
+ for (int i = 0 ; i < arrayList .size (); i ++) {
778
779
Object object = arrayList .get (i );
779
780
780
- if (object instanceof String ) {
781
+ if (object instanceof String ) {
781
782
writableArray .pushString ((String ) object );
782
- }
783
- else {
783
+ } else {
784
784
JSONObject jsonObject = objectToJSONObject (object );
785
785
writableArray .pushMap ((WritableMap ) jsonObject );
786
786
}
@@ -836,7 +836,7 @@ public void run() {
836
836
* Shows the welcome message in a specific mode.
837
837
*
838
838
* @param welcomeMessageMode An enum to set the welcome message mode to
839
- * live, or beta.
839
+ * live, or beta.
840
840
*/
841
841
@ ReactMethod
842
842
public void showWelcomeMessageWithMode (final String welcomeMessageMode ) {
@@ -858,7 +858,7 @@ public void run() {
858
858
* Sets the welcome message mode to live, beta or disabled.
859
859
*
860
860
* @param welcomeMessageMode An enum to set the welcome message mode to
861
- * live, beta or disabled.
861
+ * live, beta or disabled.
862
862
*/
863
863
@ ReactMethod
864
864
public void setWelcomeMessageMode (final String welcomeMessageMode ) {
@@ -993,7 +993,6 @@ public void run() {
993
993
* Reports that the screen name been changed (Current View).
994
994
*
995
995
* @param screenName string containing the screen name
996
- *
997
996
*/
998
997
@ ReactMethod
999
998
public void reportCurrentViewChange (final String screenName ) {
@@ -1016,7 +1015,6 @@ public void run() {
1016
1015
* Reports that the screen has been changed (Repro Steps) the screen sent to this method will be the 'current view' on the dashboard
1017
1016
*
1018
1017
* @param screenName string containing the screen name
1019
- *
1020
1018
*/
1021
1019
@ ReactMethod
1022
1020
public void reportScreenChange (final String screenName ) {
@@ -1026,7 +1024,7 @@ public void run() {
1026
1024
try {
1027
1025
Method method = getMethod (Class .forName ("com.instabug.library.Instabug" ), "reportScreenChange" , Bitmap .class , String .class );
1028
1026
if (method != null ) {
1029
- method .invoke (null , null , screenName );
1027
+ method .invoke (null , null , screenName );
1030
1028
}
1031
1029
} catch (Exception e ) {
1032
1030
e .printStackTrace ();
@@ -1120,7 +1118,7 @@ public void removeFeatureFlags(final ReadableArray featureFlags) {
1120
1118
@ Override
1121
1119
public void run () {
1122
1120
try {
1123
- ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
1121
+ ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
1124
1122
Instabug .removeFeatureFlag (stringArray );
1125
1123
} catch (Exception e ) {
1126
1124
e .printStackTrace ();
@@ -1156,11 +1154,12 @@ public void run() {
1156
1154
}
1157
1155
});
1158
1156
}
1157
+
1159
1158
/**
1160
1159
* Register a listener for W3C flags value change
1161
1160
*/
1162
1161
@ ReactMethod
1163
- public void registerW3CFlagsChangeListener (){
1162
+ public void registerW3CFlagsChangeListener () {
1164
1163
1165
1164
MainThreadHandler .runOnMainThread (new Runnable () {
1166
1165
@ Override
@@ -1177,8 +1176,7 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
1177
1176
sendEvent (Constants .IBG_ON_NEW_W3C_FLAGS_UPDATE_RECEIVED_CALLBACK , params );
1178
1177
}
1179
1178
});
1180
- }
1181
- catch (Exception e ) {
1179
+ } catch (Exception e ) {
1182
1180
e .printStackTrace ();
1183
1181
}
1184
1182
@@ -1189,18 +1187,17 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
1189
1187
1190
1188
1191
1189
/**
1192
- * Get first time Value of W3ExternalTraceID flag
1190
+ * Get first time Value of W3ExternalTraceID flag
1193
1191
*/
1194
1192
@ ReactMethod
1195
- public void isW3ExternalTraceIDEnabled (Promise promise ){
1193
+ public void isW3ExternalTraceIDEnabled (Promise promise ) {
1196
1194
1197
1195
MainThreadHandler .runOnMainThread (new Runnable () {
1198
1196
@ Override
1199
1197
public void run () {
1200
1198
try {
1201
1199
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_EXTERNAL_TRACE_ID ));
1202
- }
1203
- catch (Exception e ) {
1200
+ } catch (Exception e ) {
1204
1201
e .printStackTrace ();
1205
1202
promise .resolve (false );
1206
1203
}
@@ -1212,18 +1209,17 @@ public void run() {
1212
1209
1213
1210
1214
1211
/**
1215
- * Get first time Value of W3ExternalGeneratedHeader flag
1212
+ * Get first time Value of W3ExternalGeneratedHeader flag
1216
1213
*/
1217
1214
@ ReactMethod
1218
- public void isW3ExternalGeneratedHeaderEnabled (Promise promise ){
1215
+ public void isW3ExternalGeneratedHeaderEnabled (Promise promise ) {
1219
1216
1220
1217
MainThreadHandler .runOnMainThread (new Runnable () {
1221
1218
@ Override
1222
1219
public void run () {
1223
1220
try {
1224
1221
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_GENERATED_HEADER ));
1225
- }
1226
- catch (Exception e ) {
1222
+ } catch (Exception e ) {
1227
1223
e .printStackTrace ();
1228
1224
promise .resolve (false );
1229
1225
}
@@ -1234,18 +1230,17 @@ public void run() {
1234
1230
}
1235
1231
1236
1232
/**
1237
- * Get first time Value of W3CaughtHeader flag
1233
+ * Get first time Value of W3CaughtHeader flag
1238
1234
*/
1239
1235
@ ReactMethod
1240
- public void isW3CaughtHeaderEnabled (Promise promise ){
1236
+ public void isW3CaughtHeaderEnabled (Promise promise ) {
1241
1237
1242
1238
MainThreadHandler .runOnMainThread (new Runnable () {
1243
1239
@ Override
1244
1240
public void run () {
1245
1241
try {
1246
1242
promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_CAPTURED_HEADER ));
1247
- }
1248
- catch (Exception e ) {
1243
+ } catch (Exception e ) {
1249
1244
e .printStackTrace ();
1250
1245
promise .resolve (false );
1251
1246
}
@@ -1292,4 +1287,29 @@ public void run() {
1292
1287
}
1293
1288
});
1294
1289
}
1290
+ /**
1291
+ /**
1292
+ * Sets the auto mask screenshots types.
1293
+ *
1294
+ * @param autoMaskingTypes The masking type to be applied.
1295
+ */
1296
+ @ ReactMethod
1297
+ public void enableAutoMasking (@ NonNull ReadableArray autoMaskingTypes ) {
1298
+ MainThreadHandler .runOnMainThread (new Runnable () {
1299
+
1300
+ @ Override
1301
+ public void run () {
1302
+ int [] autoMassingTypesArray = new int [autoMaskingTypes .size ()];
1303
+ for (int i = 0 ; i < autoMaskingTypes .size (); i ++) {
1304
+ String key = autoMaskingTypes .getString (i );
1305
+
1306
+ autoMassingTypesArray [i ] = ArgsRegistry .autoMaskingTypes .get (key );
1307
+
1308
+ }
1309
+
1310
+ Instabug .setAutoMaskScreenshotsTypes (autoMassingTypesArray );
1311
+ }
1312
+
1313
+ });
1314
+ }
1295
1315
}
0 commit comments