@@ -123,7 +123,7 @@ public void setEnabled(final boolean isEnabled) {
123123 @ Override
124124 public void run () {
125125 try {
126- if (isEnabled )
126+ if (isEnabled )
127127 Instabug .enable ();
128128 else
129129 Instabug .disable ();
@@ -136,10 +136,11 @@ public void run() {
136136
137137 /**
138138 * 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.
140141 * @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.
143144 */
144145 @ ReactMethod
145146 public void init (
@@ -165,8 +166,8 @@ public void run() {
165166 .setInvocationEvents (invocationEvents )
166167 .setLogLevel (parsedLogLevel );
167168
168- if (codePushVersion != null ) {
169- if (Instabug .isBuilt ()) {
169+ if (codePushVersion != null ) {
170+ if (Instabug .isBuilt ()) {
170171 Instabug .setCodePushVersion (codePushVersion );
171172 } else {
172173 builder .setCodePushVersion (codePushVersion );
@@ -332,7 +333,7 @@ public void run() {
332333 *
333334 * @param userEmail User's default email
334335 * @param userName Username.
335- * @param userId User's ID
336+ * @param userId User's ID
336337 */
337338 @ ReactMethod
338339 public void identifyUser (
@@ -752,15 +753,15 @@ public void addFileAttachmentWithDataToReport(String data, String fileName) {
752753
753754 private WritableMap convertFromHashMapToWriteableMap (HashMap hashMap ) {
754755 WritableMap writableMap = new WritableNativeMap ();
755- for (int i = 0 ; i < hashMap .size (); i ++) {
756+ for (int i = 0 ; i < hashMap .size (); i ++) {
756757 Object key = hashMap .keySet ().toArray ()[i ];
757758 Object value = hashMap .get (key );
758- writableMap .putString ((String ) key ,(String ) value );
759+ writableMap .putString ((String ) key , (String ) value );
759760 }
760761 return writableMap ;
761762 }
762763
763- private static JSONObject objectToJSONObject (Object object ){
764+ private static JSONObject objectToJSONObject (Object object ) {
764765 Object json = null ;
765766 JSONObject jsonObject = null ;
766767 try {
@@ -777,13 +778,12 @@ private static JSONObject objectToJSONObject(Object object){
777778 private WritableArray convertArrayListToWritableArray (List arrayList ) {
778779 WritableArray writableArray = new WritableNativeArray ();
779780
780- for (int i = 0 ; i < arrayList .size (); i ++) {
781+ for (int i = 0 ; i < arrayList .size (); i ++) {
781782 Object object = arrayList .get (i );
782783
783- if (object instanceof String ) {
784+ if (object instanceof String ) {
784785 writableArray .pushString ((String ) object );
785- }
786- else {
786+ } else {
787787 JSONObject jsonObject = objectToJSONObject (object );
788788 writableArray .pushMap ((WritableMap ) jsonObject );
789789 }
@@ -839,7 +839,7 @@ public void run() {
839839 * Shows the welcome message in a specific mode.
840840 *
841841 * @param welcomeMessageMode An enum to set the welcome message mode to
842- * live, or beta.
842+ * live, or beta.
843843 */
844844 @ ReactMethod
845845 public void showWelcomeMessageWithMode (final String welcomeMessageMode ) {
@@ -861,7 +861,7 @@ public void run() {
861861 * Sets the welcome message mode to live, beta or disabled.
862862 *
863863 * @param welcomeMessageMode An enum to set the welcome message mode to
864- * live, beta or disabled.
864+ * live, beta or disabled.
865865 */
866866 @ ReactMethod
867867 public void setWelcomeMessageMode (final String welcomeMessageMode ) {
@@ -996,7 +996,6 @@ public void run() {
996996 * Reports that the screen name been changed (Current View).
997997 *
998998 * @param screenName string containing the screen name
999- *
1000999 */
10011000 @ ReactMethod
10021001 public void reportCurrentViewChange (final String screenName ) {
@@ -1019,7 +1018,6 @@ public void run() {
10191018 * Reports that the screen has been changed (Repro Steps) the screen sent to this method will be the 'current view' on the dashboard
10201019 *
10211020 * @param screenName string containing the screen name
1022- *
10231021 */
10241022 @ ReactMethod
10251023 public void reportScreenChange (final String screenName ) {
@@ -1029,7 +1027,7 @@ public void run() {
10291027 try {
10301028 Method method = getMethod (Class .forName ("com.instabug.library.Instabug" ), "reportScreenChange" , Bitmap .class , String .class );
10311029 if (method != null ) {
1032- method .invoke (null , null , screenName );
1030+ method .invoke (null , null , screenName );
10331031 }
10341032 } catch (Exception e ) {
10351033 e .printStackTrace ();
@@ -1123,7 +1121,7 @@ public void removeFeatureFlags(final ReadableArray featureFlags) {
11231121 @ Override
11241122 public void run () {
11251123 try {
1126- ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
1124+ ArrayList <String > stringArray = ArrayUtil .parseReadableArrayOfStrings (featureFlags );
11271125 Instabug .removeFeatureFlag (stringArray );
11281126 } catch (Exception e ) {
11291127 e .printStackTrace ();
@@ -1159,11 +1157,12 @@ public void run() {
11591157 }
11601158 });
11611159 }
1160+
11621161 /**
11631162 * Register a listener for W3C flags value change
11641163 */
11651164 @ ReactMethod
1166- public void registerW3CFlagsChangeListener (){
1165+ public void registerW3CFlagsChangeListener () {
11671166
11681167 MainThreadHandler .runOnMainThread (new Runnable () {
11691168 @ Override
@@ -1180,8 +1179,7 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
11801179 sendEvent (Constants .IBG_ON_NEW_W3C_FLAGS_UPDATE_RECEIVED_CALLBACK , params );
11811180 }
11821181 });
1183- }
1184- catch (Exception e ) {
1182+ } catch (Exception e ) {
11851183 e .printStackTrace ();
11861184 }
11871185
@@ -1192,18 +1190,17 @@ public void invoke(@NonNull CoreFeaturesState featuresState) {
11921190
11931191
11941192 /**
1195- * Get first time Value of W3ExternalTraceID flag
1193+ * Get first time Value of W3ExternalTraceID flag
11961194 */
11971195 @ ReactMethod
1198- public void isW3ExternalTraceIDEnabled (Promise promise ){
1196+ public void isW3ExternalTraceIDEnabled (Promise promise ) {
11991197
12001198 MainThreadHandler .runOnMainThread (new Runnable () {
12011199 @ Override
12021200 public void run () {
12031201 try {
12041202 promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_EXTERNAL_TRACE_ID ));
1205- }
1206- catch (Exception e ) {
1203+ } catch (Exception e ) {
12071204 e .printStackTrace ();
12081205 promise .resolve (false );
12091206 }
@@ -1215,18 +1212,17 @@ public void run() {
12151212
12161213
12171214 /**
1218- * Get first time Value of W3ExternalGeneratedHeader flag
1215+ * Get first time Value of W3ExternalGeneratedHeader flag
12191216 */
12201217 @ ReactMethod
1221- public void isW3ExternalGeneratedHeaderEnabled (Promise promise ){
1218+ public void isW3ExternalGeneratedHeaderEnabled (Promise promise ) {
12221219
12231220 MainThreadHandler .runOnMainThread (new Runnable () {
12241221 @ Override
12251222 public void run () {
12261223 try {
12271224 promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_GENERATED_HEADER ));
1228- }
1229- catch (Exception e ) {
1225+ } catch (Exception e ) {
12301226 e .printStackTrace ();
12311227 promise .resolve (false );
12321228 }
@@ -1237,18 +1233,17 @@ public void run() {
12371233 }
12381234
12391235 /**
1240- * Get first time Value of W3CaughtHeader flag
1236+ * Get first time Value of W3CaughtHeader flag
12411237 */
12421238 @ ReactMethod
1243- public void isW3CaughtHeaderEnabled (Promise promise ){
1239+ public void isW3CaughtHeaderEnabled (Promise promise ) {
12441240
12451241 MainThreadHandler .runOnMainThread (new Runnable () {
12461242 @ Override
12471243 public void run () {
12481244 try {
12491245 promise .resolve (InternalCore .INSTANCE ._isFeatureEnabled (CoreFeature .W3C_ATTACHING_CAPTURED_HEADER ));
1250- }
1251- catch (Exception e ) {
1246+ } catch (Exception e ) {
12521247 e .printStackTrace ();
12531248 promise .resolve (false );
12541249 }
@@ -1278,6 +1273,31 @@ public Map<String, Object> getConstants() {
12781273 return constants ;
12791274 }
12801275
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+
12811301 @ ReactMethod
12821302 public void setOnFeaturesUpdatedListener () {
12831303 InternalCore .INSTANCE ._setOnFeaturesUpdatedListener (new OnFeaturesUpdatedListener () {
0 commit comments