Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d801c0

Browse files
Adjust java code formatting
1 parent f6b2a90 commit 3d801c0

File tree

2 files changed

+130
-140
lines changed

2 files changed

+130
-140
lines changed

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

Lines changed: 69 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11

22
package com.instabug.reactlibrary;
33

4+
import android.net.Uri;
5+
46
import com.facebook.react.bridge.ReactApplicationContext;
57
import com.facebook.react.bridge.ReactContextBaseJavaModule;
68
import com.facebook.react.bridge.ReactMethod;
7-
import com.facebook.react.bridge.Callback;
8-
import android.app.Application;
99
import com.instabug.library.Instabug;
10-
import com.instabug.library.InstabugColorTheme;
11-
import com.instabug.library.InstabugTrackingDelegate;
1210
import com.instabug.library.internal.module.InstabugLocale;
1311
import com.instabug.library.invocation.InstabugInvocationEvent;
1412
import com.instabug.library.invocation.InstabugInvocationMode;
15-
import com.instabug.library.invocation.util.InstabugFloatingButtonEdge;
13+
1614
import java.util.ArrayList;
1715
import java.util.HashMap;
1816
import java.util.Locale;
19-
import android.net.Uri;
2017
import java.util.Map;
2118

2219

@@ -53,75 +50,70 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
5350
private final String LOCALE_SWEDISH = "swedish";
5451
private final String LOCALE_TURKISH = "turkish";
5552

56-
public RNInstabugReactnativeModule(ReactApplicationContext reactContext,Instabug mInstabug) {
57-
super(reactContext);
58-
this.mInstabug = mInstabug;
59-
}
53+
public RNInstabugReactnativeModule(ReactApplicationContext reactContext, Instabug mInstabug) {
54+
super(reactContext);
55+
this.mInstabug = mInstabug;
56+
}
6057

61-
@Override
62-
public String getName() {
63-
return "Instabug";
64-
}
58+
@Override
59+
public String getName() {
60+
return "Instabug";
61+
}
6562

66-
/**
63+
/**
6764
* invoke sdk manually
68-
*
6965
*/
7066
@ReactMethod
71-
public void invoke()
72-
{
67+
public void invoke() {
7368
try {
74-
mInstabug.invoke();
69+
mInstabug.invoke();
7570
} catch (Exception e) {
7671
e.printStackTrace();
7772
}
7873
}
7974

80-
/**
75+
/**
8176
* invoke sdk manually with desire invocation mode
8277
*
8378
* @param invocation mode
8479
*/
8580
@ReactMethod
86-
public void invokeWithInvocationMode(String invocationMode)
87-
{
81+
public void invokeWithInvocationMode(String invocationMode) {
8882
InstabugInvocationMode mode;
8983

9084
if (invocationMode.equals(INVOCATION_MODE_NEW_BUG)) {
9185
mode = InstabugInvocationMode.NEW_BUG;
9286
} else if (invocationMode.equals(INVOCATION_MODE_NEW_FEEDBACK)) {
9387
mode = InstabugInvocationMode.NEW_FEEDBACK;
94-
}else if (invocationMode.equals(INVOCATION_MODE_NEW_CHAT)){
88+
} else if (invocationMode.equals(INVOCATION_MODE_NEW_CHAT)) {
9589
mode = InstabugInvocationMode.NEW_CHAT;
96-
}else if (invocationMode.equals(INVOCATION_MODE_CHATS_LIST)){
90+
} else if (invocationMode.equals(INVOCATION_MODE_CHATS_LIST)) {
9791
mode = InstabugInvocationMode.CHATS_LIST;
9892
} else {
9993
mode = InstabugInvocationMode.PROMPT_OPTION;
10094
}
10195

102-
try {
103-
mInstabug.invoke(mode);
96+
try {
97+
mInstabug.invoke(mode);
10498
} catch (Exception e) {
10599
e.printStackTrace();
106100
}
107101
}
108102

109103

110-
/**
104+
/**
111105
* Dismisses all visible Instabug views
112-
*
113106
*/
114107
@ReactMethod
115-
public void dismiss()
116-
{
108+
public void dismiss() {
117109
try {
118-
mInstabug.dismiss();
110+
mInstabug.dismiss();
119111
} catch (Exception e) {
120112
e.printStackTrace();
121113
}
122114
}
123115

124-
/**
116+
/**
125117
* Adds tag(s) to issues before sending them
126118
*
127119
* @param tags
@@ -225,14 +217,15 @@ public void showIntroMessage() {
225217
}
226218
}
227219

228-
/** Set the primary color that the SDK will use to tint certain UI elements in the SDK
220+
/**
221+
* Set the primary color that the SDK will use to tint certain UI elements in the SDK
229222
*
230223
* @param primaryColorValue The value of the primary color ,
231-
* whatever this color was parsed from a resource color or hex color or RGB color values
224+
* whatever this color was parsed from a resource color or hex color or RGB color values
232225
*/
233226
@ReactMethod
234227
public void setPrimaryColor(int primaryColor) {
235-
try{
228+
try {
236229
mInstabug.setPrimaryColor(primaryColor);
237230
} catch (Exception e) {
238231
e.printStackTrace();
@@ -241,6 +234,7 @@ public void setPrimaryColor(int primaryColor) {
241234

242235
/**
243236
* Sets whether attachments in bug reporting and in-app messaging are enabled or not.
237+
*
244238
* @param {boolean} screenShot A boolean to enable or disable screenshot attachments.
245239
* @param {boolean} extraScreenShot A boolean to enable or disable extra screenshot attachments.
246240
* @param {boolean} galleryImage A boolean to enable or disable gallery image attachments.
@@ -281,9 +275,9 @@ public void log(String message) {
281275
*/
282276
@ReactMethod
283277
public ArrayList<String> getTags() {
284-
ArrayList<String> tags = new ArrayList<String>();
278+
ArrayList<String> tags = new ArrayList<String>();
285279
try {
286-
tags=mInstabug.getTags();
280+
tags = mInstabug.getTags();
287281
} catch (Exception e) {
288282
e.printStackTrace();
289283
}
@@ -292,7 +286,6 @@ public ArrayList<String> getTags() {
292286

293287
/**
294288
* Reset ALL tags added using {@link #addTags(String...)}
295-
*
296289
*/
297290
@ReactMethod
298291
public void resetTags() {
@@ -310,9 +303,9 @@ public void resetTags() {
310303
*/
311304
@ReactMethod
312305
public boolean isEnabled() {
313-
boolean isEnabled=false;
306+
boolean isEnabled = false;
314307
try {
315-
isEnabled=mInstabug.isEnabled();
308+
isEnabled = mInstabug.isEnabled();
316309
} catch (Exception e) {
317310
e.printStackTrace();
318311
}
@@ -322,7 +315,6 @@ public boolean isEnabled() {
322315

323316
/**
324317
* Enables all Instabug functionality
325-
*
326318
*/
327319
@ReactMethod
328320
public void enable() {
@@ -335,7 +327,6 @@ public void enable() {
335327

336328
/**
337329
* Disables all Instabug functionality
338-
*
339330
*/
340331
@ReactMethod
341332
public void disable() {
@@ -351,9 +342,9 @@ public void disable() {
351342
*/
352343
@ReactMethod
353344
public String getAppToken() {
354-
String appToken="";
345+
String appToken = "";
355346
try {
356-
appToken = mInstabug.getAppToken();
347+
appToken = mInstabug.getAppToken();
357348
} catch (Exception e) {
358349
e.printStackTrace();
359350
}
@@ -369,9 +360,9 @@ public String getAppToken() {
369360
*/
370361
@ReactMethod
371362
public int getUnreadMessagesCount() {
372-
int unreadMessages = 0 ;
363+
int unreadMessages = 0;
373364
try {
374-
unreadMessages = mInstabug.getUnreadMessagesCount();
365+
unreadMessages = mInstabug.getUnreadMessagesCount();
375366
} catch (Exception e) {
376367
e.printStackTrace();
377368
}
@@ -387,22 +378,22 @@ public int getUnreadMessagesCount() {
387378
*/
388379
@ReactMethod
389380
public void changeInvocationEvent(String invocationEventValue) {
390-
InstabugInvocationEvent invocationEvent=InstabugInvocationEvent.FLOATING_BUTTON;
381+
InstabugInvocationEvent invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
391382
try {
392383
//setting invocation event
393-
if(invocationEventValue.equals(INVOCATION_EVENT_FLOATING_BUTTON)) {
394-
invocationEvent=InstabugInvocationEvent.FLOATING_BUTTON;
395-
} else if(invocationEventValue.equals(INVOCATION_EVENT_TWO_FINGERS_SWIPE)) {
396-
invocationEvent=InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT;
397-
} else if(invocationEventValue.equals(INVOCATION_EVENT_SHAKE)) {
398-
invocationEvent=InstabugInvocationEvent.SHAKE;
399-
} else if(invocationEventValue.equals(INVOCATION_EVENT_SCREENSHOT)){
400-
invocationEvent=InstabugInvocationEvent.SCREENSHOT_GESTURE;
401-
} else if(invocationEventValue.equals(INVOCATION_EVENT_NONE)) {
402-
invocationEvent=InstabugInvocationEvent.NONE;
384+
if (invocationEventValue.equals(INVOCATION_EVENT_FLOATING_BUTTON)) {
385+
invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON;
386+
} else if (invocationEventValue.equals(INVOCATION_EVENT_TWO_FINGERS_SWIPE)) {
387+
invocationEvent = InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT;
388+
} else if (invocationEventValue.equals(INVOCATION_EVENT_SHAKE)) {
389+
invocationEvent = InstabugInvocationEvent.SHAKE;
390+
} else if (invocationEventValue.equals(INVOCATION_EVENT_SCREENSHOT)) {
391+
invocationEvent = InstabugInvocationEvent.SCREENSHOT_GESTURE;
392+
} else if (invocationEventValue.equals(INVOCATION_EVENT_NONE)) {
393+
invocationEvent = InstabugInvocationEvent.NONE;
403394
}
404395

405-
mInstabug.changeInvocationEvent(invocationEvent);
396+
mInstabug.changeInvocationEvent(invocationEvent);
406397
} catch (Exception e) {
407398
e.printStackTrace();
408399
}
@@ -417,7 +408,7 @@ public void changeInvocationEvent(String invocationEventValue) {
417408
@ReactMethod
418409
public void setChatNotificationEnabled(boolean isChatNotificationEnable) {
419410
try {
420-
mInstabug.setChatNotificationEnabled(isChatNotificationEnable);
411+
mInstabug.setChatNotificationEnabled(isChatNotificationEnable);
421412
} catch (Exception e) {
422413
e.printStackTrace();
423414
}
@@ -433,48 +424,48 @@ public void setChatNotificationEnabled(boolean isChatNotificationEnable) {
433424
@ReactMethod
434425
public void setDebugEnabled(boolean isDebugEnabled) {
435426
try {
436-
mInstabug.setDebugEnabled(isDebugEnabled);
427+
mInstabug.setDebugEnabled(isDebugEnabled);
437428
} catch (Exception e) {
438429
e.printStackTrace();
439430
}
440431
}
441432

442433
private Locale getLocaleByKey(String instabugLocale) {
443-
String localeInLowerCase=instabugLocale.toLowerCase();
434+
String localeInLowerCase = instabugLocale.toLowerCase();
444435
case LOCALE_ARABIC:
445-
return new Locale(InstabugLocale.ARABIC.getCode(), InstabugLocale.ARABIC.getCountry());
436+
return new Locale(InstabugLocale.ARABIC.getCode(), InstabugLocale.ARABIC.getCountry());
446437
case LOCALE_ENGLISH:
447-
return new Locale(InstabugLocale.ENGLISH.getCode(), InstabugLocale.ENGLISH.getCountry());
438+
return new Locale(InstabugLocale.ENGLISH.getCode(), InstabugLocale.ENGLISH.getCountry());
448439
case LOCALE_CZECH:
449-
return new Locale(InstabugLocale.CZECH.getCode(), InstabugLocale.CZECH.getCountry());
440+
return new Locale(InstabugLocale.CZECH.getCode(), InstabugLocale.CZECH.getCountry());
450441
case LOCALE_FRENCH:
451-
return new Locale(InstabugLocale.FRENCH.getCode(), InstabugLocale.FRENCH.getCountry());
442+
return new Locale(InstabugLocale.FRENCH.getCode(), InstabugLocale.FRENCH.getCountry());
452443
case LOCALE_GERMAN:
453-
return new Locale(InstabugLocale.GERMAN.getCode(), InstabugLocale.GERMAN.getCountry());
444+
return new Locale(InstabugLocale.GERMAN.getCode(), InstabugLocale.GERMAN.getCountry());
454445
case LOCALE_ITALIAN:
455-
return new Locale(InstabugLocale.ITALIAN.getCode(), InstabugLocale.ITALIAN.getCountry());
446+
return new Locale(InstabugLocale.ITALIAN.getCode(), InstabugLocale.ITALIAN.getCountry());
456447
case LOCALE_JAPANESE:
457-
return new Locale(InstabugLocale.JAPANESE.getCode(), InstabugLocale.JAPANESE.getCountry());
448+
return new Locale(InstabugLocale.JAPANESE.getCode(), InstabugLocale.JAPANESE.getCountry());
458449
case LOCALE_POLISH:
459-
return new Locale(InstabugLocale.POLISH.getCode(), InstabugLocale.POLISH.getCountry());
450+
return new Locale(InstabugLocale.POLISH.getCode(), InstabugLocale.POLISH.getCountry());
460451
case LOCALE_RUSSIAN:
461-
return new Locale(InstabugLocale.RUSSIAN.getCode(), InstabugLocale.RUSSIAN.getCountry());
452+
return new Locale(InstabugLocale.RUSSIAN.getCode(), InstabugLocale.RUSSIAN.getCountry());
462453
case LOCALE_SPANISH:
463-
return new Locale(InstabugLocale.SPANISH.getCode(), InstabugLocale.SPANISH.getCountry());
454+
return new Locale(InstabugLocale.SPANISH.getCode(), InstabugLocale.SPANISH.getCountry());
464455
case LOCALE_SWEDISH:
465-
return new Locale(InstabugLocale.SWEDISH.getCode(), InstabugLocale.SWEDISH.getCountry());
456+
return new Locale(InstabugLocale.SWEDISH.getCode(), InstabugLocale.SWEDISH.getCountry());
466457
case LOCALE_TURKISH:
467-
return new Locale(InstabugLocale.TURKISH.getCode(), InstabugLocale.TURKISH.getCountry());
458+
return new Locale(InstabugLocale.TURKISH.getCode(), InstabugLocale.TURKISH.getCountry());
468459
case LOCALE_PORTUGUESE_BRAZIL:
469-
return new Locale(InstabugLocale.PORTUGUESE_BRAZIL.getCode(), InstabugLocale.PORTUGUESE_BRAZIL.getCountry());
460+
return new Locale(InstabugLocale.PORTUGUESE_BRAZIL.getCode(), InstabugLocale.PORTUGUESE_BRAZIL.getCountry());
470461
case LOCALE_CHINESE_SIMPLIFIED:
471-
return new Locale(InstabugLocale.SIMPLIFIED_CHINESE.getCode(), InstabugLocale.SIMPLIFIED_CHINESE.getCountry());
462+
return new Locale(InstabugLocale.SIMPLIFIED_CHINESE.getCode(), InstabugLocale.SIMPLIFIED_CHINESE.getCountry());
472463
case LOCALE_CHINESE_TRADITIONAL:
473-
return new Locale(InstabugLocale.TRADITIONAL_CHINESE.getCode(), InstabugLocale.TRADITIONAL_CHINESE.getCountry());
464+
return new Locale(InstabugLocale.TRADITIONAL_CHINESE.getCode(), InstabugLocale.TRADITIONAL_CHINESE.getCountry());
474465
case LOCALE_KOREAN:
475-
return new Locale(InstabugLocale.KOREAN.getCode(), InstabugLocale.KOREAN.getCountry());
466+
return new Locale(InstabugLocale.KOREAN.getCode(), InstabugLocale.KOREAN.getCountry());
476467
default:
477-
return new Locale(InstabugLocale.ENGLISH.getCode(), InstabugLocale.ENGLISH.getCountry());
468+
return new Locale(InstabugLocale.ENGLISH.getCode(), InstabugLocale.ENGLISH.getCountry());
478469
}
479470

480471
@Override

0 commit comments

Comments
 (0)