NTP-11577 | Cybertron Integration

This commit is contained in:
yashmantri
2024-11-11 16:56:00 +05:30
parent 67be1b05ed
commit 8223949828
15 changed files with 60 additions and 126 deletions

46
App.tsx
View File

@@ -48,52 +48,12 @@ import { setJsErrorHandler } from './src/services/exception-handler.service';
import fetchUpdatedRemoteConfig from './src/services/firebaseFetchAndUpdate.service';
import { StorageKeys } from './src/types/storageKeys';
import CodePushLoadingModal, { CodePushLoadingModalRef } from './CodePushModal';
import { createTransport } from '@sentry/core';
import * as Sentry from '@sentry/react-native';
import { initSentry } from '@components/utlis/sentry';
function makeFetchTransport(options: any): any {
function makeRequest(request: any) {
const requestOptions: RequestInit = {
body: request.body,
method: 'POST',
referrerPolicy: 'origin',
headers: options.headers,
...options.fetchOptions,
};
return fetch(options.url, requestOptions).then((response) => {
console.log({ options, requestOptions, response });
toast({ type: 'success', text1: options?.url });
return {
statusCode: response.status,
headers: {
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
'retry-after': response.headers.get('Retry-After'),
},
};
});
}
return createTransport(options, makeRequest);
if (!__DEV__) {
initSentry();
}
Sentry.init({
dsn: 'https://98c6621b8fa4447389ea43c67172154d@o4508256125911040.ingest.us.sentry.io/4508256126107648',
transport: makeFetchTransport,
tunnel: 'https://qa-sa.navi.com/cybertron/api/4/envelope?sentry_key=',
beforeSend(event) {
event.extra = {
...event.extra,
release_id: getAppVersion(),
alfredSessionId: '',
metadata: {},
};
return event;
},
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// enableSpotlight: __DEV__,
});
if (ENV !== 'prod') {
// mockApiServer();
}

View File

@@ -1,7 +0,0 @@
auth.token=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
defaults.org=navi-l1
defaults.project=react-native
defaults.url=https://sentry.io/

View File

@@ -1,13 +1,12 @@
import { MILLISECONDS_IN_A_MINUTE, MINUTES_IN_AN_HOUR } from '../../RN-UI-LIB/src/utlis/common';
export const BASE_AV_APP_URL = 'https://qa-longhorn-server.np.navi-ppl.in/field-app';
export const SENTRY_DSN =
'https://acef93c884c1424cacc4ec899562e203@qa-longhorn-server.np.navi-ppl.in/glitchtip-events/173';
export const JANUS_SERVICE_URL = 'https://qa-longhorn-server.np.navi-ppl.in/api/events/json';
export const SENTRY_DSN = 'https://navi@qa-sa.navi.com/cybertron/4';
export const JANUS_SERVICE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/api/events/json';
export const ENV = 'qa';
export const IS_SSO_ENABLED = true;
export const APM_APP_NAME = 'cosmos-app';
export const APM_BASE_URL = 'https://qa-longhorn-server.np.navi-ppl.in/apm-events';
export const APM_BASE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/apm-events';
export const IS_DATA_SYNC_REQUIRED = true;
export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_A_MINUTE; // 2hr
export const GOOGLE_SSO_CLIENT_ID =

View File

@@ -184,7 +184,6 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
20788EEE27084AE2A60AD608 /* Upload Debug Symbols to Sentry */,
);
buildRules = (
);
@@ -265,8 +264,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\"\"\n";
};
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; };
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -398,20 +396,6 @@
shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n";
showEnvVarsInLog = 0;
};
20788EEE27084AE2A60AD608 /* Upload Debug Symbols to Sentry */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
name = "Upload Debug Symbols to Sentry";
inputPaths = (
);
outputPaths = (
);
shellPath = /bin/sh;
shellScript = "/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */

View File

@@ -1,7 +0,0 @@
auth.token=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
defaults.org=navi-l1
defaults.project=react-native
defaults.url=https://sentry.io/

View File

@@ -1,6 +1,4 @@
const {
withSentryConfig
} = require("@sentry/react-native/metro");
const { withSentryConfig } = require('@sentry/react-native/metro');
/**
* Metro configuration for React Native
@@ -18,4 +16,4 @@ module.exports = withSentryConfig({
},
}),
},
});
});

View File

@@ -56,7 +56,7 @@
"@react-navigation/native": "6.1.4",
"@react-navigation/native-stack": "6.9.4",
"@reduxjs/toolkit": "1.9.1",
"@sentry/react-native": "^5.35.0",
"@sentry/react-native": "5.35.0",
"@shopify/flash-list": "1.4.3",
"@supersami/rn-foreground-service": "^2.1.0",
"appcenter": "^4.4.5",

View File

@@ -200,9 +200,9 @@ const BlockerScreen = (props: IBlockerScreen) => {
// Higher Priotrity to Post Operative Hours
if (!withinOperativeHours && isLoggedIn && !GLOBAL.IS_IMPERSONATED) return <PostOperativeHours />;
// if (shouldUpdate.newApkCachedUrl) {
// return <AppUpdate onAppUpdate={handleAppUpdate} />;
// }
if (shouldUpdate.newApkCachedUrl) {
return <AppUpdate onAppUpdate={handleAppUpdate} />;
}
if (shouldUpdate.switchToFallback) {
const { heading, instructions } = BLOCKER_SCREEN_DATA.UNINSTALL_APP;

View File

@@ -359,7 +359,7 @@ axiosInstance.interceptors.response.use(
if ([API_STATUS_CODE.UNAUTHORIZED, API_STATUS_CODE.FORBIDDEN].includes(response.status)) {
// Reset user info
// dispatch(handleLogout());
dispatch(handleLogout());
}
// Blocking cosmos after operative hours
@@ -368,7 +368,6 @@ axiosInstance.interceptors.response.use(
dispatch(setWithinOperativeHours(false));
}
}
return Promise.reject(error);
}
config.retry -= 1;

View File

@@ -2,10 +2,10 @@ import * as Sentry from '@sentry/react-native';
import { GLOBAL } from '../../constants/Global';
export const logError = (error: Error, extraInfo = '') => {
// if(__DEV__) {
// // Disable sentry in development mode
// return;
// }
if(__DEV__) {
// Disable sentry in development mode
return;
}
Sentry.setTag('agentId', GLOBAL.AGENT_ID || 'not-logged-in');
Sentry.captureException(error, (scope) => {
scope.setExtra('ExtraInfo', extraInfo);

View File

@@ -1,37 +1,51 @@
import * as Sentry from '@sentry/react-native';
import VersionNumber from 'react-native-version-number';
import { SENTRY_DSN, ENV } from '../../constants/config';
import { addClickstreamEvent } from '../../services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '../../common/Constants';
import { getAppVersion } from './commonFunctions';
import { createTransport } from '@sentry/core';
import { toast } from '@rn-ui-lib/components/toast';
const sentryRoutingInstrumentation = new Sentry.ReactNavigationInstrumentation();
function makeFetchTransport(options: any): any {
function makeRequest(request: any) {
const requestOptions: RequestInit = {
body: request.body,
method: 'POST',
referrerPolicy: 'origin',
headers: options.headers,
...options.fetchOptions,
};
const defaultOptions = {
dsn: SENTRY_DSN,
enableAutoSessionTracking: true,
environment: ENV,
// integrations: [
// new Sentry.ReactNativeTracing({
// routingInstrumentation: sentryRoutingInstrumentation,
// tracingOrigins: ['localhost', /^\//],
// }),
// ],
tracesSampleRate: 0.2,
};
return fetch(options.url, requestOptions).then((response) => {
toast({ type: 'success', text1: options?.url });
return {
statusCode: response.status,
headers: {
'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
'retry-after': response.headers.get('Retry-After'),
},
};
});
}
return createTransport(options, makeRequest);
}
export async function initSentry() {
try {
const dist = `${VersionNumber.buildVersion}`;
const release = `${VersionNumber.bundleIdentifier}(${getAppVersion()})@${
VersionNumber.appVersion
}+${dist}`;
Sentry.init({
...defaultOptions,
dist,
release,
dsn: SENTRY_DSN,
transport: makeFetchTransport,
tunnel: 'https://qa-sa.navi.com/cybertron/api/4/envelope?sentry_key=',
beforeSend(event) {
event.extra = {
...event.extra,
release_id: getAppVersion(),
alfredSessionId: '',
metadata: {},
};
return event;
},
});
} catch (e) {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_SENTRY_INTEGRATION_FAILED);

View File

@@ -1,13 +1,12 @@
import { MILLISECONDS_IN_A_MINUTE, MINUTES_IN_AN_HOUR } from '../../RN-UI-LIB/src/utlis/common';
export const BASE_AV_APP_URL = 'https://qa-longhorn-server.np.navi-ppl.in/field-app';
export const SENTRY_DSN =
'https://acef93c884c1424cacc4ec899562e203@qa-longhorn-server.np.navi-ppl.in/glitchtip-events/173';
export const JANUS_SERVICE_URL = 'https://qa-longhorn-server.np.navi-ppl.in/api/events/json';
export const SENTRY_DSN = 'https://navi@qa-sa.navi.com/cybertron/4';
export const JANUS_SERVICE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/api/events/json';
export const ENV = 'qa';
export const IS_SSO_ENABLED = true;
export const APM_APP_NAME = 'cosmos-app';
export const APM_BASE_URL = 'https://qa-longhorn-server.np.navi-ppl.in/apm-events';
export const APM_BASE_URL = 'https://qa-longhorn-portal.np.navi-tech.in/apm-events';
export const IS_DATA_SYNC_REQUIRED = true;
export const DATA_SYNC_TIME_INTERVAL = 2 * MINUTES_IN_AN_HOUR * MILLISECONDS_IN_A_MINUTE; // 2hr
export const GOOGLE_SSO_CLIENT_ID =

View File

@@ -121,7 +121,7 @@ const Profile: React.FC = () => {
]}
>
{hideUploadImageBtn ? null : <IDCardImageCapture />}
{getNavigationLinks().tmp.data.map((link, index) => {
{getNavigationLinks().do.dp.map((link, index) => {
if (!link.isVisible) return null;
return (
<View style={{ marginBottom: 10 }} key={link.name}>

View File

@@ -25,10 +25,6 @@ const CasesListScreen = (props: IAllCasesListScreenProps) => {
const pinnedList = useAppSelector((state) => state.allCases.pinnedList);
const completedList = useAppSelector((state) => state.allCases.completedList);
const isCallActive = useAppSelector((state) => state?.activeCall?.activeCallDetails?.callActive);
const onCrashClick = ()=> {
const a = undefined;
console.log(a.varnit);
};
const isCommitmentFormVisible = useAppSelector(
(state) => state.commitmentTracker.isCommitmentFormVisible
@@ -69,7 +65,6 @@ const CasesListScreen = (props: IAllCasesListScreenProps) => {
textStyle={styles.titleText}
/>
) : null}
<Button title={'Crash'} onPress={onCrashClick} />
</>
);
};

View File

@@ -1838,7 +1838,7 @@
"@sentry/utils" "7.119.1"
localforage "^1.8.1"
"@sentry/react-native@^5.35.0":
"@sentry/react-native@5.35.0":
version "5.35.0"
resolved "https://registry.yarnpkg.com/@sentry/react-native/-/react-native-5.35.0.tgz#22afc7b339aaa764101d8786e9240e1d1737077c"
integrity sha512-fJIwB2rK6LSFqaPN+f6sa/N0/027AJFtTY3UVmjNl4stY7Q3S/L6fIP4qJJF6YMYeZc+/j8+m+1R1yHvXMX3ew==