Skip to content

Commit e86987f

Browse files
author
niklasfessler
committed
added log network
1 parent 0fe5d93 commit e86987f

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

bugbattle/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ext {
1313
siteUrl = 'https://github.com/BugBattle/Android-SDK'
1414
gitUrl = 'https://github.com/BugBattle/Android-SDK.git'
1515

16-
libraryVersion = '3.1.9'
16+
libraryVersion = '3.3.0'
1717

1818
developerId = 'BugBattle GmbH'
1919
developerName = 'BugBattle'

bugbattle/src/main/java/bugbattle/io/bugbattle/BugBattle.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
import bugbattle.io.bugbattle.controller.BugBattleNotInitialisedException;
1515
import bugbattle.io.bugbattle.model.APPLICATIONTYPE;
1616
import bugbattle.io.bugbattle.model.FeedbackModel;
17+
import bugbattle.io.bugbattle.model.Networklog;
1718
import bugbattle.io.bugbattle.model.PhoneMeta;
19+
import bugbattle.io.bugbattle.model.RequestType;
1820
import bugbattle.io.bugbattle.service.BBDetector;
21+
import bugbattle.io.bugbattle.service.BugBattleHttpInterceptor;
1922
import bugbattle.io.bugbattle.service.ReplaysDetector;
2023
import bugbattle.io.bugbattle.service.ScreenshotGestureDetector;
2124
import bugbattle.io.bugbattle.service.ScreenshotTaker;
@@ -245,8 +248,26 @@ public static void setLanguage(String language) {
245248
FeedbackModel.getInstance().setLanguage(language);
246249
}
247250

251+
/**
252+
* Attach Data to the request. The Data will be merged into the body sent with the bugreport.
253+
* !!Existing keys can be overriten
254+
* @param data Data, which is added
255+
*/
248256
public static void attachData(JSONObject data) {
249257
FeedbackModel.getInstance().setData(data);
250258
}
251259

260+
/**
261+
* Log network traffic by logging it manually.
262+
* @param urlConnection URL where the request is sent to
263+
* @param requestType GET, POST, PUT, DELETE
264+
* @param status status of the response (e.g. 200, 404)
265+
* @param duration duration of the request
266+
* @param request Add the data you want. e.g the body sent in the request
267+
* @param response Response of the call. You can add just the information you want and need.
268+
*/
269+
public static void logNetwork(String urlConnection, RequestType requestType, int status, int duration, JSONObject request, JSONObject response) {
270+
BugBattleHttpInterceptor.log(urlConnection, requestType, status, duration, request, response);
271+
}
272+
252273
}

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
repositories {
77
google()
88
jcenter()
9-
9+
mavenCentral() // NEW
1010
}
1111
dependencies {
1212
classpath 'com.android.tools.build:gradle:4.0.2'
@@ -30,6 +30,8 @@ allprojects {
3030
}
3131

3232

33+
34+
3335
task clean(type: Delete) {
3436
delete rootProject.buildDir
3537
}

0 commit comments

Comments
 (0)