Skip to content

Commit 33a4f06

Browse files
committed
💎 Bump version to 8.0.11
2 parents 4fdd937 + 7d5c2be commit 33a4f06

36 files changed

+314
-1096
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.instabug.library.ui.onboarding.WelcomeMessage;
4444
import com.instabug.library.InstabugCustomTextPlaceHolder;
4545
import com.instabug.library.model.Report;
46+
import com.instabug.library.model.NetworkLog;
4647
import com.instabug.library.user.UserEventParam;
4748
import com.instabug.library.visualusersteps.State;
4849

@@ -1983,6 +1984,27 @@ public void setEmailFieldRequiredForActions(boolean isEmailRequired, ReadableArr
19831984
}
19841985
}
19851986

1987+
/**
1988+
* Extracts HTTP connection properties. Request method, Headers, Date, Url and Response code
1989+
*
1990+
* @param jsonObject the JSON object containing all HTTP connection properties
1991+
* @throws JSONException
1992+
*/
1993+
@ReactMethod
1994+
public void networkLog(String jsonObject) throws JSONException {
1995+
NetworkLog networkLog = new NetworkLog();
1996+
String date = System.currentTimeMillis()+"";
1997+
networkLog.setDate(date);
1998+
JSONObject newJSONObject = new JSONObject(jsonObject);
1999+
networkLog.setUrl(newJSONObject.getString("url"));
2000+
networkLog.setRequest(newJSONObject.getString("requestBody"));
2001+
networkLog.setResponse(newJSONObject.getString("responseBody"));
2002+
networkLog.setMethod(newJSONObject.getString("method"));
2003+
networkLog.setResponseCode(newJSONObject.getInt("responseCode"));
2004+
networkLog.setHeaders(newJSONObject.getString("headers"));
2005+
networkLog.insert();
2006+
}
2007+
19862008
private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) {
19872009
switch (key) {
19882010
case SHAKE_HINT:
@@ -2167,7 +2189,7 @@ public Map<String, Object> getConstants() {
21672189
constants.put("localeDutch", LOCALE_DUTCH);
21682190
constants.put("localeEnglish", LOCALE_ENGLISH);
21692191
constants.put("localeFrench", LOCALE_FRENCH);
2170-
constants.put("localeGerman", LOCALE_FRENCH);
2192+
constants.put("localeGerman", LOCALE_GERMAN);
21712193
constants.put("localeKorean", LOCALE_KOREAN);
21722194
constants.put("localeItalian", LOCALE_ITALIAN);
21732195
constants.put("localeJapanese", LOCALE_JAPANESE);

index.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,60 @@ import {
55
Platform
66
} from 'react-native';
77
let { Instabug } = NativeModules;
8+
import interceptor from './utils/NetworkInterceptor.js';
89
import InstabugUtils from './utils/InstabugUtils.js';
910
import BugReporting from './modules/BugReporting.js';
1011
import Surveys from './modules/Surveys.js';
1112
import FeatureRequests from './modules/FeatureRequests.js';
1213

1314
InstabugUtils.captureJsErrors();
1415

16+
var jsonObject = {
17+
url: '',
18+
requestBody: '',
19+
responseBody: '',
20+
method: '',
21+
responseCode: undefined,
22+
headers: ''
23+
}
24+
25+
// Register the interceptor for fetch requests
26+
interceptor.register({
27+
request: function (url, config) {
28+
// Modify the url or config here
29+
jsonObject.url = url;
30+
if(!config || !config.method) {
31+
//TO-DO: set method to GET!
32+
jsonObject.method = 'GET';
33+
}
34+
if(config) {
35+
if(config.body) {
36+
jsonObject.requestBody = config.body;
37+
} else {
38+
jsonObject.requestBody = '';
39+
}
40+
if(config.method) {
41+
jsonObject.method = config.method;
42+
}
43+
if(config.headers) {
44+
jsonObject.headers = config.headers;
45+
} else {
46+
jsonObject.headers = '';
47+
}
48+
}
49+
return [url, config];
50+
},
51+
response: function (response) {
52+
// Modify the reponse object;
53+
jsonObject.responseCode = response.status;
54+
jsonObject.responseBody = response._bodyText;
55+
if (Platform.OS === 'android') {
56+
Instabug.networkLog(JSON.stringify(jsonObject));
57+
}
58+
return response;
59+
}
60+
});
61+
1562
/**
1663
* Instabug
1764
* @exports Instabug

ios/Instabug.framework/Headers/IBGBugReporting.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ NS_SWIFT_NAME(BugReporting)
5656
@property(class, atomic, assign) IBGInvocationEvent invocationEvents;
5757

5858
/**
59-
@brief Sets the threshold value of the shake gesture for iPhone/iPod Touch
59+
@brief Sets the threshold value of the shake gesture for iPhone/iPod Touch.
6060
61-
@discussion Default for iPhone is 2.5.
61+
@discussion Default for iPhone is 2.5. The lower the threshold, the easier it will be to invoke Instabug with the
62+
shake gesture. A threshold which is too low will cause Instabug to be invoked unintentionally.
6263
*/
6364
@property(class, atomic, assign) CGFloat shakingThresholdForiPhone;
6465

6566
/**
6667
@brief Sets the threshold value of the shake gesture for iPad.
6768
68-
@discussion Default for iPad is 0.6.
69+
@discussion Default for iPad is 0.6. The lower the threshold, the easier it will be to invoke Instabug with the
70+
shake gesture. A threshold which is too low will cause Instabug to be invoked unintentionally.
6971
*/
7072
@property(class, atomic, assign) CGFloat shakingThresholdForiPad;
7173

0 commit comments

Comments
 (0)