Skip to content

Commit 4b1b0b9

Browse files
feat: exclude DEV server url from network logs
1 parent cccaa51 commit 4b1b0b9

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/modules/Instabug.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { captureUnhandledRejections } from '../utils/UnhandledRejectionTracking'
2626
import type { ReproConfig } from '../models/ReproConfig';
2727
import type { FeatureFlag } from '../models/FeatureFlag';
2828
import InstabugConstants from '../utils/InstabugConstants';
29+
import { InstabugRNConfig } from '../utils/config';
2930

3031
let _currentScreen: string | null = null;
3132
let _lastScreen: string | null = null;
@@ -637,7 +638,7 @@ export const willRedirectToStore = () => {
637638
* This API has be called when changing the default Metro server port (8081) to exclude the DEV URL from network logging.
638639
*/
639640
export const setMetroDevServerPort = (port: number) => {
640-
InstabugConstants.METRO_SERVER_URL = port.toString();
641+
InstabugRNConfig.metroDevServerPort = port.toString();
641642
};
642643

643644
export const componentDidAppearListener = (event: ComponentDidAppearEvent) => {

src/modules/NetworkLogger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { RequestHandler } from '@apollo/client';
33
import InstabugConstants from '../utils/InstabugConstants';
44
import xhr, { NetworkData, ProgressCallback } from '../utils/XhrNetworkInterceptor';
55
import { isContentTypeNotAllowed, reportNetworkLog } from '../utils/InstabugUtils';
6+
import { InstabugRNConfig } from '../utils/config';
67

78
export type { NetworkData };
89

@@ -34,7 +35,7 @@ export const setEnabled = (isEnabled: boolean) => {
3435

3536
if (__DEV__) {
3637
const urlPort = getPortFromUrl(network.url);
37-
if (urlPort === InstabugConstants.METRO_SERVER_URL) {
38+
if (urlPort === InstabugRNConfig.metroDevServerPort) {
3839
return;
3940
}
4041
}

src/utils/InstabugConstants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const InstabugConstants = {
1111
'IBG-RN: Expected key and value passed to setUserAttribute to be of type string',
1212
REMOVE_USER_ATTRIBUTES_ERROR_TYPE_MESSAGE:
1313
'IBG-RN: Expected key and value passed to removeUserAttribute to be of type string',
14-
METRO_SERVER_URL: '8081',
14+
DEFAULT_METRO_SERVER_URL: '8081',
1515
};
1616

1717
export default InstabugConstants;

src/utils/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import InstabugConstants from './InstabugConstants';
2+
3+
export const InstabugRNConfig = {
4+
metroDevServerPort: InstabugConstants.DEFAULT_METRO_SERVER_URL,
5+
};

0 commit comments

Comments
 (0)