From 58b2be84c38bec4cd9027814eece1a712f250ce8 Mon Sep 17 00:00:00 2001 From: yashmantri Date: Tue, 11 Jun 2024 23:06:31 +0530 Subject: [PATCH] TP-66615 | Imperonsation check added --- src/action/profileActions.ts | 4 +++- src/common/BlockerScreen.tsx | 2 +- src/reducer/profileSlice.ts | 3 +++ src/screens/Profile/index.tsx | 6 ++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/action/profileActions.ts b/src/action/profileActions.ts index 7ce5bd06..bbf32846 100644 --- a/src/action/profileActions.ts +++ b/src/action/profileActions.ts @@ -48,7 +48,7 @@ export const getSelfieDocument = .then((res) => { const { documents, agencyName, agencyCode } = res.data; if (res.data?.documents?.[0]) { - const { originalDocumentUri, optimizedDocumentUri, approvalStatus, comment } = + const { originalDocumentUri, optimizedDocumentUri, approvalStatus, comment, referenceId } = documents?.[0] || {}; dispatch( setOriginalImageDetails({ @@ -58,6 +58,7 @@ export const getSelfieDocument = agencyCode: agencyCode || '', optimizedImageUri: optimizedDocumentUri || '', comment: comment || '', + documentRefId: referenceId || '' }) ); @@ -72,6 +73,7 @@ export const getSelfieDocument = agencyCode: agencyCode || '', comment: '', approvalStatus: ImageApprovalStatus.NOT_INITIATED, + documentRefId: '' }) ); } diff --git a/src/common/BlockerScreen.tsx b/src/common/BlockerScreen.tsx index 44882c1d..0db0f5a1 100644 --- a/src/common/BlockerScreen.tsx +++ b/src/common/BlockerScreen.tsx @@ -223,7 +223,7 @@ const BlockerScreen = (props: IBlockerScreen) => { }); return ; } - if (IdCardBlockStatus[approvalStatus as keyof typeof IdCardBlockStatus] && isFieldAgent) { + if (IdCardBlockStatus[approvalStatus as keyof typeof IdCardBlockStatus] && isFieldAgent && !GLOBAL.IS_IMPERSONATED) { return ( <> diff --git a/src/reducer/profileSlice.ts b/src/reducer/profileSlice.ts index 972e9732..8afcb48d 100644 --- a/src/reducer/profileSlice.ts +++ b/src/reducer/profileSlice.ts @@ -29,6 +29,7 @@ const initialState = { optimizedImageUri: '', showApprovedModal: false, isLoading: false, + documentRefId: '' }; export const profileSlice = createSlice({ @@ -46,6 +47,7 @@ export const profileSlice = createSlice({ agencyName, agencyCode, comment, + documentRefId } = action.payload; state.originalImageUri = originalImageUri; state.approvalStatus = approvalStatus; @@ -53,6 +55,7 @@ export const profileSlice = createSlice({ state.agencyCode = agencyCode; state.optimizedImageUri = optimizedImageUri; state.comment = comment; + state.documentRefId = documentRefId; }, setIsUploadingImage: (state, action) => { state.isUploadingImage = action.payload; diff --git a/src/screens/Profile/index.tsx b/src/screens/Profile/index.tsx index 9647b8e8..e9f77db8 100644 --- a/src/screens/Profile/index.tsx +++ b/src/screens/Profile/index.tsx @@ -38,13 +38,15 @@ const Profile: React.FC = () => { const supportLink = useAppSelector((state) => state.config.data?.supportLink); const isTeamLead = useAppSelector((state) => state.user.isTeamLead); const referenceId = useAppSelector((state) => state.user.user?.referenceId); + const documentRefId = useAppSelector((state) => state.profile?.documentRefId); + const showAttendanceBanner = useAppSelector( (state) => state.user?.agentAttendance?.showAttendanceBanner ); const originalImageUri = useAppSelector((state) => state.profile?.originalImageUri); const cacheDirectory = RNFS.CachesDirectoryPath; - const cacheFilePath = `${cacheDirectory}/${phoneNumber}_${name}.jpg`; + const cacheFilePath = `${cacheDirectory}/${documentRefId}_${name}.jpg`; useFocusEffect( React.useCallback(() => { @@ -108,7 +110,7 @@ const Profile: React.FC = () => { />