TP-72939 | Ms clarity added
This commit is contained in:
19
App.tsx
19
App.tsx
@@ -26,7 +26,7 @@ import {
|
||||
} from '@components/utlis/commonFunctions';
|
||||
import { linkingConf } from '@components/utlis/deeplinkingUtils';
|
||||
import { getBuildFlavour } from '@components/utlis/DeviceUtils';
|
||||
import { setGlobalBuildFlavour } from '@constants/Global';
|
||||
import { GLOBAL, setGlobalBuildFlavour } from '@constants/Global';
|
||||
import analytics from '@react-native-firebase/analytics';
|
||||
import dayJs from 'dayjs';
|
||||
import { COLORS } from './RN-UI-LIB/src/styles/colors';
|
||||
@@ -51,14 +51,6 @@ import { initialize, setCurrentScreenName } from 'react-native-clarity';
|
||||
|
||||
initSentry();
|
||||
|
||||
if (ENV === 'prod') {
|
||||
getAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, true).then((value) => {
|
||||
if (MS_CLARITY_PROJECT_ID && value) {
|
||||
initialize(MS_CLARITY_PROJECT_ID);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setJsErrorHandler();
|
||||
LogBox.ignoreAllLogs();
|
||||
|
||||
@@ -155,6 +147,15 @@ function App() {
|
||||
checkCodePushAndSync();
|
||||
setForegroundTimeStampAndClickstream();
|
||||
|
||||
if (ENV === 'prod') {
|
||||
getAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, true).then((value) => {
|
||||
if (MS_CLARITY_PROJECT_ID && value && !GLOBAL.MS_CLARITY_INITIALIZED) {
|
||||
initialize(MS_CLARITY_PROJECT_ID);
|
||||
GLOBAL.MS_CLARITY_INITIALIZED = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
appStateChange.remove();
|
||||
};
|
||||
|
||||
@@ -104,7 +104,6 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
const pendingList = useAppSelector((state) => state.allCases.pendingList);
|
||||
const pinnedList = useAppSelector((state) => state.allCases.pinnedList);
|
||||
|
||||
|
||||
const handleTimeSync = async () => {
|
||||
try {
|
||||
if (!isOnline) {
|
||||
@@ -379,8 +378,14 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
|
||||
dispatch(getConfigData());
|
||||
CosmosForegroundService.start(tasks);
|
||||
resyncFirebase();
|
||||
const msClarityResponse = await getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], { 'x-customer-id': GLOBAL.AGENT_ID });
|
||||
const dataSyncResponse = await getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], { 'x-customer-id': GLOBAL.AGENT_ID });
|
||||
const msClarityResponse = await getLitmusExperimentResult(
|
||||
LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY],
|
||||
{ 'x-customer-id': GLOBAL.AGENT_ID, deviceId: GLOBAL.DEVICE_ID }
|
||||
);
|
||||
const dataSyncResponse = await getLitmusExperimentResult(
|
||||
LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC],
|
||||
{ 'x-customer-id': GLOBAL.AGENT_ID }
|
||||
);
|
||||
|
||||
setAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, msClarityResponse);
|
||||
setAsyncStorageItem(LocalStorageKeys.IS_DATA_SYNC_ALLOWED, dataSyncResponse);
|
||||
|
||||
@@ -4,7 +4,12 @@ import { getUniqueId, isTablet } from 'react-native-device-info';
|
||||
import { useAppDispatch, useAppSelector } from '../../hooks';
|
||||
import { type RootState } from '../../store/store';
|
||||
import { setAgentAttendance, setDeviceId } from '../../reducer/userSlice';
|
||||
import { DEVICE_TYPE_ENUM, GLOBAL, setGlobalUserData, setMsClarityConfig } from '../../constants/Global';
|
||||
import {
|
||||
DEVICE_TYPE_ENUM,
|
||||
GLOBAL,
|
||||
setGlobalUserData,
|
||||
setMsClarityConfig,
|
||||
} from '../../constants/Global';
|
||||
import { registerNavigateAndDispatch } from '../../components/utlis/apiHelper';
|
||||
import ProtectedRouter from './ProtectedRouter';
|
||||
import useNativeButtons from '../../hooks/useNativeButton';
|
||||
@@ -126,11 +131,6 @@ function AuthRouter() {
|
||||
CosmosForegroundService.stopAll();
|
||||
}
|
||||
});
|
||||
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], {
|
||||
'x-customer-id': GLOBAL.AGENT_ID,
|
||||
}).then((response) => {
|
||||
setAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, response);
|
||||
});
|
||||
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.COSMOS_DATA_SYNC], {
|
||||
'x-customer-id': GLOBAL.AGENT_ID,
|
||||
}).then((response) => {
|
||||
@@ -139,6 +139,17 @@ function AuthRouter() {
|
||||
}
|
||||
}, [isLoggedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (GLOBAL.DEVICE_ID) {
|
||||
getLitmusExperimentResult(LitmusExperimentNameMap[LitmusExperimentName.MS_CLARITY], {
|
||||
'x-customer-id': GLOBAL.AGENT_ID,
|
||||
deviceId: GLOBAL.DEVICE_ID,
|
||||
}).then((response) => {
|
||||
setAsyncStorageItem(LocalStorageKeys.IS_CLARITY_ENABLED, response);
|
||||
});
|
||||
}
|
||||
}, [GLOBAL.DEVICE_ID]);
|
||||
|
||||
// Firebase cloud messaging listener
|
||||
useFCM();
|
||||
useScreenshotTracking();
|
||||
|
||||
Reference in New Issue
Block a user