Skip to content

Commit 73f5dcd

Browse files
fix RNInstabugReactnativePackage constructors order
1 parent d6b6587 commit 73f5dcd

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

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

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ public RNInstabugReactnativePackage(Instabug instabug) {
3232
}
3333

3434
public RNInstabugReactnativePackage(String androidApplicationToken,Application application) {
35-
this.androidApplication = application;
36-
this.mAndroidApplicationToken = androidApplicationToken;
37-
38-
mInstabug = new Instabug.Builder(androidApplication, mAndroidApplicationToken)
39-
.setEmailFieldRequired(false)
40-
.setFloatingButtonOffsetFromTop(400)
41-
.setTheme(this.instabugColorTheme)
42-
.setInvocationEvent(this.invocationEvent)
43-
.setIntroMessageEnabled(false)
44-
.build();
35+
this(androidApplicationToken,application,this.invocationEvent);
4536
}
4637

4738
public RNInstabugReactnativePackage(String androidApplicationToken,Application application,String invocationEventValue) {
39+
this(androidApplicationToken,application,invocationEventValue,this.instabugColorThemeValue);
40+
}
41+
42+
public RNInstabugReactnativePackage(String androidApplicationToken,Application application,
43+
String invocationEventValue,String instabugColorThemeValue) {
44+
45+
this.androidApplication = application;
46+
this.mAndroidApplicationToken = androidApplicationToken;
47+
48+
//setting invocation event
4849
if(invocationEventValue.equals("button")) {
4950
this.invocationEvent=InstabugInvocationEvent.FLOATING_BUTTON;
5051
} else if(invocationEventValue.equals("swipe")) {
@@ -63,21 +64,23 @@ public RNInstabugReactnativePackage(String androidApplicationToken,Application a
6364
this.invocationEvent=InstabugInvocationEvent.FLOATING_BUTTON;
6465
}
6566

66-
this(androidApplicationToken,application);
67-
68-
}
69-
70-
public RNInstabugReactnativePackage(String androidApplicationToken,Application application,String invocationEventValue,String instabugColorThemeValue) {
71-
if (instabugColorThemeValue.equals("light")) {
72-
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeLight;
73-
} else if (instabugColorThemeValue.equals("dark")) {
74-
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeDark;
75-
} else {
76-
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeLight;
77-
}
67+
//setting instabugColorTheme
68+
if (instabugColorThemeValue.equals("light")) {
69+
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeLight;
70+
} else if (instabugColorThemeValue.equals("dark")) {
71+
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeDark;
72+
} else {
73+
this.instabugColorTheme=InstabugColorTheme.InstabugColorThemeLight;
74+
}
7875

79-
this(androidApplicationToken,application,invocationEventValue);
8076

77+
mInstabug = new Instabug.Builder(this.androidApplication,this.mAndroidApplicationToken)
78+
.setEmailFieldRequired(false)
79+
.setFloatingButtonOffsetFromTop(400)
80+
.setTheme(this.instabugColorTheme)
81+
.setInvocationEvent(this.invocationEvent)
82+
.setIntroMessageEnabled(false)
83+
.build();
8184
}
8285

8386
@Override

0 commit comments

Comments
 (0)