1111import com .getcapacitor .PluginMethod ;
1212import com .getcapacitor .annotation .ActivityCallback ;
1313import com .getcapacitor .annotation .CapacitorPlugin ;
14-
1514import java .net .URL ;
1615
1716@ CapacitorPlugin (name = "Bugfender" )
@@ -36,7 +35,8 @@ public void init(PluginCall call) {
3635 }
3736 // endregion before init
3837
39- boolean debug = call .getBoolean ("debug" ,
38+ boolean debug = call .getBoolean (
39+ "debug" ,
4040 call .getBoolean ("printToConsole" , false )
4141 );
4242 Bugfender .init (getContext (), call .getString ("appKey" ), debug );
@@ -55,7 +55,10 @@ public void init(PluginCall call) {
5555 Bugfender .enableUIEventLogging (getActivity ().getApplication ());
5656 }
5757
58- boolean registerErrorHandler = call .getBoolean ("registerErrorHandler" , false );
58+ boolean registerErrorHandler = call .getBoolean (
59+ "registerErrorHandler" ,
60+ false
61+ );
5962 if (registerErrorHandler ) {
6063 Bugfender .enableCrashReporting ();
6164 }
@@ -78,7 +81,9 @@ public void getDeviceURL(PluginCall call) {
7881 response .put ("url" , url .toString ());
7982 call .resolve (response );
8083 } else {
81- call .reject ("Bugfender SDK is not initialized. You should call first to the method Bugfender.init()" );
84+ call .reject (
85+ "Bugfender SDK is not initialized. You should call first to the method Bugfender.init()"
86+ );
8287 }
8388 }
8489
@@ -90,7 +95,9 @@ public void getSessionURL(PluginCall call) {
9095 response .put ("url" , url .toString ());
9196 call .resolve (response );
9297 } else {
93- call .reject ("Bugfender SDK is not initialized. You should call first to the method Bugfender.init()" );
98+ call .reject (
99+ "Bugfender SDK is not initialized. You should call first to the method Bugfender.init()"
100+ );
94101 }
95102 }
96103
@@ -103,8 +110,16 @@ public void getUserFeedback(PluginCall call) {
103110 String sendButtonText = call .getString ("submitLabel" );
104111 startActivityForResult (
105112 call ,
106- Bugfender .getUserFeedbackActivityIntent (getActivity ().getApplication (), title , hint , subjectHint , messageHint , sendButtonText ),
107- "getUserFeedbackResult" );
113+ Bugfender .getUserFeedbackActivityIntent (
114+ getActivity ().getApplication (),
115+ title ,
116+ hint ,
117+ subjectHint ,
118+ messageHint ,
119+ sendButtonText
120+ ),
121+ "getUserFeedbackResult"
122+ );
108123 }
109124
110125 @ ActivityCallback
@@ -114,7 +129,10 @@ private void getUserFeedbackResult(PluginCall call, ActivityResult result) {
114129 }
115130 if (result .getResultCode () == Activity .RESULT_OK ) {
116131 JSObject response = new JSObject ();
117- response .put ("url" , result .getData ().getStringExtra (FeedbackActivity .RESULT_FEEDBACK_URL ));
132+ response .put (
133+ "url" ,
134+ result .getData ().getStringExtra (FeedbackActivity .RESULT_FEEDBACK_URL )
135+ );
118136 call .resolve (response );
119137 } else {
120138 call .reject ("Feedback not sent" );
@@ -165,25 +183,35 @@ public void removeDeviceKey(PluginCall call) {
165183
166184 @ PluginMethod
167185 public void sendCrash (PluginCall call ) {
168- URL url = Bugfender .sendCrash (call .getString ("title" ), call .getString ("text" ));
186+ URL url = Bugfender .sendCrash (
187+ call .getString ("title" ),
188+ call .getString ("text" )
189+ );
169190 if (url != null ) {
170191 JSObject response = new JSObject ();
171192 response .put ("url" , url .toString ());
172193 call .resolve (response );
173194 } else {
174- call .reject ("Bugfender SDK is not initialized. You should call first to the method Bugfender.init()" );
195+ call .reject (
196+ "Bugfender SDK is not initialized. You should call first to the method Bugfender.init()"
197+ );
175198 }
176199 }
177200
178201 @ PluginMethod
179202 public void sendIssue (PluginCall call ) {
180- URL url = Bugfender .sendIssue (call .getString ("title" ), call .getString ("text" ));
203+ URL url = Bugfender .sendIssue (
204+ call .getString ("title" ),
205+ call .getString ("text" )
206+ );
181207 if (url != null ) {
182208 JSObject response = new JSObject ();
183209 response .put ("url" , url .toString ());
184210 call .resolve (response );
185211 } else {
186- call .reject ("Bugfender SDK is not initialized. You should call first to the method Bugfender.init()" );
212+ call .reject (
213+ "Bugfender SDK is not initialized. You should call first to the method Bugfender.init()"
214+ );
187215 }
188216 }
189217
@@ -219,13 +247,18 @@ private static LogLevel parseLogLevel(int logLevel) {
219247
220248 @ PluginMethod
221249 public void sendUserFeedback (PluginCall call ) {
222- URL url = Bugfender .sendUserFeedback (call .getString ("title" ), call .getString ("text" ));
250+ URL url = Bugfender .sendUserFeedback (
251+ call .getString ("title" ),
252+ call .getString ("text" )
253+ );
223254 if (url != null ) {
224255 JSObject response = new JSObject ();
225256 response .put ("url" , url .toString ());
226257 call .resolve (response );
227258 } else {
228- call .reject ("Bugfender SDK is not initialized. You should call first to the method Bugfender.init()" );
259+ call .reject (
260+ "Bugfender SDK is not initialized. You should call first to the method Bugfender.init()"
261+ );
229262 }
230263 }
231264
@@ -270,5 +303,4 @@ public void setForceEnabled(PluginCall call) {
270303 Bugfender .setForceEnabled (call .getBoolean ("state" ));
271304 call .resolve ();
272305 }
273-
274306}
0 commit comments