diff --git a/App.tsx b/App.tsx index 4da40b94..beff05e5 100644 --- a/App.tsx +++ b/App.tsx @@ -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(); } diff --git a/android/sentry.properties b/android/sentry.properties deleted file mode 100644 index af69fca5..00000000 --- a/android/sentry.properties +++ /dev/null @@ -1,7 +0,0 @@ - -auth.token=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 - -defaults.org=navi-l1 -defaults.project=react-native - -defaults.url=https://sentry.io/ diff --git a/config/qa/config.js b/config/qa/config.js index fa45a329..f629deaf 100644 --- a/config/qa/config.js +++ b/config/qa/config.js @@ -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 = diff --git a/ios/AVAPP.xcodeproj/project.pbxproj b/ios/AVAPP.xcodeproj/project.pbxproj index 7482cc60..131e9edc 100644 --- a/ios/AVAPP.xcodeproj/project.pbxproj +++ b/ios/AVAPP.xcodeproj/project.pbxproj @@ -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 */ diff --git a/ios/sentry.properties b/ios/sentry.properties deleted file mode 100644 index af69fca5..00000000 --- a/ios/sentry.properties +++ /dev/null @@ -1,7 +0,0 @@ - -auth.token=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 - -defaults.org=navi-l1 -defaults.project=react-native - -defaults.url=https://sentry.io/ diff --git a/metro.config.js b/metro.config.js index 8a5628af..97d828f8 100644 --- a/metro.config.js +++ b/metro.config.js @@ -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({ }, }), }, -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index e7a04cc3..2867af09 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/common/BlockerScreen.tsx b/src/common/BlockerScreen.tsx index 324386c7..51553f2f 100644 --- a/src/common/BlockerScreen.tsx +++ b/src/common/BlockerScreen.tsx @@ -200,9 +200,9 @@ const BlockerScreen = (props: IBlockerScreen) => { // Higher Priotrity to Post Operative Hours if (!withinOperativeHours && isLoggedIn && !GLOBAL.IS_IMPERSONATED) return ; - // if (shouldUpdate.newApkCachedUrl) { - // return ; - // } + if (shouldUpdate.newApkCachedUrl) { + return ; + } if (shouldUpdate.switchToFallback) { const { heading, instructions } = BLOCKER_SCREEN_DATA.UNINSTALL_APP; diff --git a/src/components/utlis/apiHelper.ts b/src/components/utlis/apiHelper.ts index 3511bda7..081c0d7c 100644 --- a/src/components/utlis/apiHelper.ts +++ b/src/components/utlis/apiHelper.ts @@ -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; diff --git a/src/components/utlis/errorUtils.ts b/src/components/utlis/errorUtils.ts index 32dd8fbd..aeac3011 100644 --- a/src/components/utlis/errorUtils.ts +++ b/src/components/utlis/errorUtils.ts @@ -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); diff --git a/src/components/utlis/sentry.ts b/src/components/utlis/sentry.ts index 29d363fc..afe819ed 100644 --- a/src/components/utlis/sentry.ts +++ b/src/components/utlis/sentry.ts @@ -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); diff --git a/src/constants/config.js b/src/constants/config.js index fa45a329..f629deaf 100644 --- a/src/constants/config.js +++ b/src/constants/config.js @@ -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 = diff --git a/src/screens/Profile/index.tsx b/src/screens/Profile/index.tsx index 340619fa..f5ff270f 100644 --- a/src/screens/Profile/index.tsx +++ b/src/screens/Profile/index.tsx @@ -121,7 +121,7 @@ const Profile: React.FC = () => { ]} > {hideUploadImageBtn ? null : } - {getNavigationLinks().tmp.data.map((link, index) => { + {getNavigationLinks().do.dp.map((link, index) => { if (!link.isVisible) return null; return ( diff --git a/src/screens/allCases/CasesListScreen.tsx b/src/screens/allCases/CasesListScreen.tsx index 402f8dad..4d9c3154 100644 --- a/src/screens/allCases/CasesListScreen.tsx +++ b/src/screens/allCases/CasesListScreen.tsx @@ -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} -