From 2fb990628bd4ca9072bbcaa95af8b1fa00d918c9 Mon Sep 17 00:00:00 2001 From: himanshu-kansal Date: Thu, 8 Jun 2023 15:20:51 +0530 Subject: [PATCH] TP-30224 | Review comment fix --- App.tsx | 2 +- src/common/Constants.ts | 4 ++++ src/components/utlis/sentry.ts | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/App.tsx b/App.tsx index 2f6344d4..53b6cfb6 100644 --- a/App.tsx +++ b/App.tsx @@ -34,6 +34,7 @@ import AuthRouter from './src/screens/auth/AuthRouter'; import { initSentry } from './src/components/utlis/sentry'; Sentry.init({ dsn: SENTRY_DSN }); +initSentry(); if (ENV !== 'prod') { // mockApiServer(); @@ -90,7 +91,6 @@ const App = () => { }); React.useEffect(() => { - initSentry(); const appStateChange = AppState.addEventListener('change', (change) => { handleAppStateChange(change); askForPermissions(setPermissions); diff --git a/src/common/Constants.ts b/src/common/Constants.ts index d02c4fb9..239d623f 100644 --- a/src/common/Constants.ts +++ b/src/common/Constants.ts @@ -473,6 +473,10 @@ export const CLICKSTREAM_EVENT_NAMES = { name: 'FA_VISIT_PLAN_LOAD', description: 'FA_VISIT_PLAN_LOAD', }, + FA_SENTRY_INTEGRATION_FAILED: { + name: 'FA_SENTRY_INTEGRATION_FAILED', + description: 'Sentry Integration failed', + }, } as const; export enum MimeType { diff --git a/src/components/utlis/sentry.ts b/src/components/utlis/sentry.ts index 125b1c2c..be8644b1 100644 --- a/src/components/utlis/sentry.ts +++ b/src/components/utlis/sentry.ts @@ -2,6 +2,9 @@ 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'; const sentryRoutingInstrumentation = new Sentry.ReactNavigationInstrumentation(); @@ -21,7 +24,9 @@ const defaultOptions = { export async function initSentry() { try { const dist = `${VersionNumber.buildVersion}`; - const release = `${VersionNumber.bundleIdentifier}@${VersionNumber.appVersion}+${dist}`; + const release = `${VersionNumber.bundleIdentifier}(${getAppVersion()})@${ + VersionNumber.appVersion + }+${dist}`; Sentry.init({ ...defaultOptions, @@ -29,6 +34,7 @@ export async function initSentry() { release, }); } catch (e) { + addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_SENTRY_INTEGRATION_FAILED); console.error('Sentry initialization failed'); } }