TP-30224 | Review comment fix

This commit is contained in:
himanshu-kansal
2023-06-08 15:20:51 +05:30
committed by Aman Chaturvedi
parent 7169761473
commit 2fb990628b
3 changed files with 12 additions and 2 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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');
}
}